title: Batch up a number of jobs to run concurrently

text: > **Possible Duplicate:**   >  Four tasks in parallel… how do I do that? I have a group of jobs to run (a few hundred jobs) - they have a variety of command names and parameters. Each one runs anywhere from a few minutes to a few hours (and I don't really know which ones will run longer than others until I run them). They are pretty much CPU bound, but some do significant I/O, so I want to run 4 at a time (one per CPU core). Is there already a simple command to do this? Something like _runbatch -n 4 filename_ that will read the file and execute n jobs at a time until it's done. Since some of the command lines have special characters and spaces in parameters, using _xargs -P_ to run them under _bash -c_ seems a little problematic to get everything escaped properly. I've thought about just building a makefile and using _make -j_ or building a simple Perl job scheduler that runs jobs in the background and dispatches a new one as each one finishes, but wanted to see if there was a more elegant solution that already exists?


title: Bash wait for jobs and limit job count

text: > **Possible Duplicate:**   >  Four tasks in parallel… how do I do that? Suppose a loop invoking a command                grep -v '#' < files.m3u | sed 's/\\\\/\/\//g' | sed 's/\\/\//g' | while read line      do         filename=$(basename "$line")         avconv -i "$line" "${filename%.*}.wav"      done      Putting & after avconv will keep spawning avconv for each file. Now I want to do two things:   * I want to limit the number of processes spawned to 4   * When the loop is done I want to wait for the last one to be ready


title: running strace for specific period of time

text: How to run strace on a user process for specific period of time, say 1 minute, without terminating the user process and without using Ctrl+C? I want to create a script to automating strace execution for a user process.


title: Where are my ALSA, pulseaudio lib

text: I tried to install darkice with lame. To compile it, I need ALSA and Pulsaudio:               checking for lame library at /usr ... found at /usr      checking for vorbis libraries at /usr ... configure: WARNING: not found, building without Ogg Vorbis     checking for opus libraries at /usr ... configure: WARNING: not found, building without Ogg Opus     checking for faac library at /usr ... configure: WARNING: not found, building without faac     checking for aacplus library at /usr ... configure: WARNING: not found, building without aacplus     checking for twolame library at /usr ... configure: WARNING: not found, building without twolame     checking for alsa libraries at /usr/lib/alsa-lib ... configure: WARNING: not found, building without ALSA support     checking for pulseaudio libraries at /usr/lib64/pulseaudio/libpulse ... configure: WARNING: not found, building without PULSEAUDIO support     checking for jack libraries at /usr ... configure: WARNING: not found, building without JACK support     checking for samplerate libraries at /usr ... configure: WARNING: not found, building libsamplerate support      I can add with `\--with-*-prefix=` a path for this libraries. But I have no idea where on my system I can find them, or what I need to install, to compile with them. I tried `/usr/lib` and `/usr/lib64`, both don't work. **My question is where do I get these libraries from?** system: Fedora release 19 (Schrödinger’s Cat) 3.11.6-200.fc19.x86_64


title: confusing about PSS in /proc/pid/maps

text: I found one great explanation about smaps from info about smaps To my understanding, I thought that > shared_clean + shared_dirty + private_clean + private_dirty = rss I wrote a program to verify it:               void sa();     int main(int argc,char *argv[])     {         sa();         sleep(1000);     }          void sa()     {        char *pi=new char[1024*1024*10];        for(int i=0;i<4;++i) {   //dirty should be 4M             for(int j=0;j<1024*1024;++j){                     *pi='o';                     pi++;             }        }        int cnt;        for(int i=0;i<6;++i) {   //clean should be 6M             for(int j=0;j<1024*1024;++j){                     cnt+=*pi;                     pi++;             }        }        printf("%d",cnt);     }      But to my surprise,the `/proc/pid/smaps` is:               09b69000-09b8c000 rw-p 00000000 00:00 0 [heap]     ...     Size:           10252 kB     Rss:            10252 kB     Pss:             4108 kB //<----I thought it should be 10M     Shared_Clean:       0 kB     Shared_Dirty:       0 kB     Private_Clean:      0 kB //<----I thought it should be 6M     Private_Dirty:   4108 kB     Referenced:      4108 kB     Swap:               0 kB     KernelPageSize:     4 kB     MMUPageSize:        4 kB      Anything wrong with my understanding? * * * according to answer of Mat, > The pages in the 6M you're only reading can't really be considered clean. A > clean page is one that is synchronized with its backing store (whatever that > is, swap, a file, etc.). . I rewrite the codes using mmap,this time its result is as expected :) create a dummy file first:               time dd if=/dev/zero of=test.bin bs=30000000 count=1      new code:               void sa(char *pi)     {        for(int i=0;i<4;++i) {             for(int j=0;j<1024*1024;++j){                     *pi='a';                     pi++;             }        }        //just to use it to avoid the following code will not optimized off by the compiler         int dummycnt=0;        for(int i=0;i<6;++i) {             for(int j=0;j<1024*1024;++j){                     dummycnt+=*pi;                     pi++;             }        }        printf("%d",dummycnt);     }               int main()     {            int fd  = open("./test.bin",O_RDWR);            char *p = (char *)mmap(0,                           1024*1024*10, //10M                           PROT_READ|PROT_WRITE,                           MAP_SHARED,                           fd,                           0);            sa(p);            sleep(10000);     }       cat /proc/pid/smaps:               b6eae000-b78ae000 rw-s 00000000 08:05 134424     ..../test.bin     Size:              10240 kB     Rss:               10240 kB     Pss:               10240 kB     Shared_Clean:          0 kB     Shared_Dirty:          0 kB     Private_Clean:      6144 kB     Private_Dirty:      4096 kB     Referenced:        10240 kB     Swap:                  0 kB     KernelPageSize:        4 kB     MMUPageSize:           4 kB


title: Regular expressions with ExpectJ

text: I've been used the ExpectJ Java library to automate some jobs on a Linux server, however now I need to automate a job that sends a different text response for each execution. Here is the output:               Last unsuccessful login: Fri Mar 30 15:21:31 CST 2012      ********************************************************************************          ********************************************************************************     [YOU HAVE NEW MAIL]      local-login [/home/user]%      And in my code I have the following:               s.expect("Login as:");     s.send("userlogin\n");     s.expect("userlogin@iphost's password:");     s.send("password\n");      I receive the output shown, but I wasn't be able to send the next command because I don't know how read the last answer, I tried to use a regular expression but it doesn't work.


title: How can I find a file whose name includes a given string, such as "abcde"?

text: Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?


title: How to find a file containing a string?

text: > **Possible Duplicate:**   >  How can I find a file whose name includes a given string, such as "abcde"? How to find files in terminal that contains the string "foo"? I tried the following but doesn't work.               find *foo*.*  // any character before or after "foo" of any extension.      I tried googling UNIX or bash wild card but doesn't provide me any useful result.


title: Copy image from clipboard to file

text: Is it possible to take an image from the clipboard and output it to a file (using X)? I can do this with text easily:               $ xclip -selection c -o > file.text      But when I try the above with an image nothing is written. * * * The reason I want to do this is I don't have an image editor installed, and it got me thinking whether I could do this without installing one.


title: Gajim, gtalk, and logind

text: Since the Google talk outage earlier this month, I keep not being able to connect using gajim. I tried deleting all the configuration, updated to the latest development version, and tried in different IM clients (pidgin works fine) but so far gajim refuses to log into gtalk: it claims I have the "wrong password or username". Those are correct and work fine in pidgin. The only clue I have is this error I keep getting in `~/.xsession-errors` or on `stdout` when I run gajim.               (E) gajim.logind_listener A problem occured while activating logind listener      Any idea?


title: VIM: Display Hex Code Inline

text: I would like to have hex codes been displayed inline, no matter what filetype is activated in the current session. So far I've found something existent and suitable for my needs: https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim I tried to recode the syntax file to effect all types of code, but didn't get it in the end. To be honest, I've just no clue about coding for vim. Could anyone help? I would be really glad if someone could... =/


title: Upgrading to linux kernel 3.0.1 but my ethernet card is still not found?

text: Please forgive my ignorance, as I am still fairly new when it comes to linux under the hood! Anyways - following up on my previous semi-related post, instead of trying a Debian testing image, I installed Debian stable and installed the latest 3.0.1 kernel via dpkg. Specifically:   1. Ran `apt-get update` on internet enabled computer (computer A)   2. Transplanted /var/lib/apt/lists and /etc/apt/sources.list from computer A to new laptop with no internet (computer B)   3. `apt-get --print-uris --yes install synaptic | grep ^\' | cut -d\' -f2 > packageuri.htm` to get package download URLs   4. Downloaded the packages from computer A and copied them to computer B   5. Installed synaptic with dpkg   6. Ran synaptic and updated the laptop by generating a download script (feature in synaptic)   7. Ran script from computer A, copied packages to computer B, `dpkg -i *.deb`   8. Downloaded the linux-image and all related files (though `apt`, synaptic didn't let me install `linux-image-3.0.1-*` for some reason) similarly to step 3   9. Installed files via `dpkg`. `update-grub` was run and new kernel is detected   10. Boot into new system, still have no internet. According to this link, installing >= 2.6.38 should allow the card to be used. Am I missing something? Thanks!


title: Can I make grep treat escaped multiline as a single line?

text: How can I make tools like `grep` treat multilines escaped with a backslash as a long single line? Let's say I have some files that looks like this:               testvar=test1 \             test2 \             test3          othervar=oth1 \              oth2      If I now `grep` for testvar it will return `testvar=test1 \`, but is there any way I can have it return `testvar=test1 test2 test3`? More or less how to treat those multiple escaped lines as a single line? **Note** : If this can't be done with `grep`, hints about how to do this with other tools like `sed` or `awk` to get the same result are also welcome.


title: Windows and Ubuntu dual boot

text: I have installed Ubuntu 14.04 on a partition. Now I have Ubuntu and Windows 8.1 for dual boot. I followed this tutorial to install Ubuntu.   Now when I switch on the computer I have the following options in the grub.   * Ubuntu   * Ubuntu (advandced)   * Windows Boot Manager (on /dev/sda2)   * System setup Is this normal? I mean, what is Windows Boot Manager? Should it say just Windows?   Why can I access the BIOS if I select System Setup?


title: Line spacing in chat using pidgin

text: I started using pidgin again and I cannot find the option to configure line spacing in chat. the default appears to be 1.5 lines between messages. How can I change that? Or is it another "feature" that all users will love so there is no way to configure it? Yeah, kinda frustrated with it...


title: How can I modify and rebuild the Finnix ISO to include my own scripts?

text: I've been using this live boot distro, Finnix to do some installation work on several virtual machines. I'd like to modify the ISO file to include a script I need to do installations. I've booted the virtual machine and gotten as far as copying the `/dev/cdrom` contents to a new Folder and modified it as needed. Now I'd like to turn the plain folder back into a bootable ISO image and `nc` it back to my host machine for subsequent boots, modified with my additional content. How can I turn the folder with the modified content back into a bootable ISO image?


title: Replace "-from" with "this" in the begining of line

text: I want to replace "-from" with "this" in the begining of line. This should happen when that line has 'R' at the end and line above it has "D" at the end. For example for the block shown below:               -from XXXXXXXXXXXXXXXXX/D        -from XXXXXXXXXXXXXXXXX/R        -from XXXXXXXXXXXXXXXXX/K        -from XXXXXXXXXXXXXXXXX/L        -from XXXXXXXXXXXXXXXXX/G        -from XXXXXXXXXXXXXXXXX/R       the output should look like:               -from XXXXXXXXXXXXXXXXX/D        -this XXXXXXXXXXXXXXXXX/R        -from XXXXXXXXXXXXXXXXX/K        -from XXXXXXXXXXXXXXXXX/L        -from XXXXXXXXXXXXXXXXX/G        -from XXXXXXXXXXXXXXXXX/R        Anything is fine, `sed`, `awk`, `grep`, etc.


title: RHEL - Login screen not showing

text: I have a **RHEL 5.6** system which shut down unexpectedly due to a power failure. I restarted the machine to figure out if something is wrong. However, the machine is not showing the login screen. It is stuck after the services listing page.(The page where the OS will notify the loading of services is OK or failed). I am trying to figure out someway to login to the system.               ctrl + alt + F7 - This key combination will allow me to login to the graphical interface.           ctrl + alt + F1 - This key combination will allow me to login to the command line mode of Linux.       Is there any other way to login to the system? Because, the system is stuck and am not pretty sure, even if the above mentioned methods might work.


title: Cross-compiling Slackware: is the build order listed anywhere?

text: I'm building a Slackware system from source and hitting a dependency wall here. (Before you ask: no, I'm not trying to "make it faster"; I'm building against a different C library.) Getting a toolchain and the very basics (coreutils, archivers, shell, perl, kernel, etc.) was simple enough, but when I look at the remaining several hundred packages I don't know what order they need to be built in to meet their dependencies. Looking through the various docs I don't see any build order listed, and there's no master build script either, just the individual packages' SlackBuilds. And .tgz's don't list dependencies like deb's or RPM's do. Is this just something Patrick keeps in his head that the rest of us mortals will have to figure out manually, or am I missing a doc somewhere? I tried using BLFS but Slackware seems to build X much earlier in the process than BLFS does. I suppose I can simply try to build everything, note when dependencies fail, and manually make a dependency tree, but I'm hoping there's just a build list somewhere I'm missing...


title: Position of "double_buffer yes" in ~/.conkyrc

text: According to the Archlinux wiki, in the "Prevent flickering" section, the line "double_buffer yes" should be placed "below the other options, not below TEXT or XY". But when I look at Crunchbang default Conky, there are several options (not TEXT or XY) below "double_buffer yes" (line 45). So is the positioning of "double_buffer yes" not critical (so long as it is above TEXT or XY)?


title: SpellCheck in FreeBSD

text: In FreeBSD; the SpellCheck doesn't work for me.   For example I installed `midori` from the ports. In dependencies it installed `enchant`and `enchant` had the option for some dictionary (i.e. Hspell, Aspell ...). I went with `aspell`. I even installed `aspell-en`dictionary. But at the end I have no spell check in FreeBSD.


title: Checking if a file exists in several directories

text: I've been working on this far too long and need some help. I need a script that will look at files in a directory and see if it exists in one of several directories. I need something like this:               for files in /downloads/ #may or may not be in a sub-directory     do        print if file exists in /media/tv, /media/movie, or /media/music     done      the files will not be in the root of the directory. I cant just search /media, because I don't want to search in cd-rom or videos I am using the latest version of Ubuntu server


title: addgroup vs groupadd

text: I happen to know there is a slight difference between `adduser` and `useradd`.   (i.e., `adduser` has additional features to `useradd`, such as creating a home directory.) Then what is the relation between `addgroup` and `groupadd`?   Is there a preferred way to create a group?


title: Unable to set partition type correctly using parted

text: I'm trying to create a bootable USB stick with FreeDos for BIOS updates in Centos 6.5, following instructions from: chtaube.de I created the empty 30MB img file using `dd`:               [root@dumbledore freedos_boot]# dd if=/dev/zero of=FreeDos-image.img bs=1M      count=30     30+0 records in     30+0 records out     31457280 bytes (31 MB) copied, 0.0756911 s, 416 MB/s      The author of the mentioned article says this command should copy 30MB, I get 31MB. Is this a problem? Then I use `parted` to create partitions in the resulting FreeDos-image.img file.               root@dumbledore freedos_boot]# parted FreeDos-image.img      GNU Parted 2.1     Using /home/dthacker/freedos_boot/FreeDos-image.img     Welcome to GNU Parted! Type 'help' to view a list of commands.     (parted) unit %     (parted) mklabel msdos                                                          (parted) mkpart primary fat16 0 100%     Warning: The resulting partition is not properly aligned for best performance.      Ignore/Cancel? C                                                               (parted) mkpart primary fat32 0 100%     Warning: The resulting partition is not properly aligned for best performance.     Ignore/Cancel? I                                                               (parted) set 1 boot on                                                         (parted) p                                                                       Model:  (file)     Disk /home/dthacker/freedos_boot/FreeDos-image.img: 100%     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start  End   Size  Type     File system  Flags     1      0.00%  100%  100%  primary               boot, lba                                                                                The File System type should be FAT16, but it's not getting set. What do I need to do differently to set it correctly?


title: How can I get high-precision timestamps (better than 1s) with Samba?

text: I did a quick test and got the results below. Whats with the horrible time resolution? Is there a way I can make it better?               creation     129971441605098285     mod     129971442166583272     a.ToFileTimeUtc()     129971442170000000     b.ToFileTimeUtc()     129971442170000000      The results of ToFileTimeUtc (which returns the number of 100ns ticks since Jan 1, 1601) show that the timestamps have been rounded to the nearest second, instead of being stored with their full precision. I'm using Samba on Ubuntu. I grabbed the config file from somewhere. I'm transferring files to a NTFS filesystem mounted by linux over samba               [global]     netbios name = toltec     workgroup = METRAN     security = user     wins support = yes     preferred master = yes     os level = 65               [homes]     comment = %u's Home Directory     browsable = no     read only = no


title: Difference between 'ifconfig' and 'ip' commands

text: I read some articles/tutorials on 'ifconfig' command, most of them included a common statement - > "ifconfig is deprecated by ip command" and suggested to learn ip command. But none of them explained how 'ip' command is more powerful than 'ifconfig'. What is the difference between both of them?


title: How to backup all my data?

text: I need to backup all my data from a server (in 10 minutes), preferably keeping the symlinks. Any suggestions?


title: linux + squashfs-tools for red-hat 5.3

text: I want to install the squashfs-tools-4.0-5.el6.i686.rpm But I have the following dependencies ( after RPM installation ) please advice what the additional packages that I need to install on my linux red-hat 5.3 in order to solve the dependencies issue ?               [root@localhost WORK]# rpm -i squashfs-tools-4.0-5.el6.i686.rpm      warning: squashfs-tools-4.0-5.el6.i686.rpm: Header V3 RSA/SHA1 signature: NOKEY, key  ID c105b9de       error: Failed dependencies:         libc.so.6(GLIBC_2.11) is needed by squashfs-tools-4.0-5.el6.i686         libc.so.6(GLIBC_2.7) is needed by squashfs-tools-4.0-5.el6.i686         rpmlib(FileDigests) <= 4.6.0-1 is needed by squashfs-tools-4.0-5.el6.i686         rpmlib(PayloadIsXz) <= 5.2-1 is needed by squashfs-tools-4.0-5.el6.i686      uname -a                  [root@localhost WORK]# uname -a         Linux localhost 2.6.18-128.el5PAE #1 SMP Wed Dec 17 12:02:33 EST 2008 i686 i686 i386 GNU/Linux


title: How to change the user timezone?

text: I know that (for example in Debian) one could use `dpkg-reconfigure tzdata` to change the timezone of the **system** but I am wondering how one could change the **user** timezone (if Linux/Unix supports such an idea at all). I normally work on the server remotely through ssh and given that the server works with UTC internally (files, ...) and timezones are rather superficial, I would like to see the times in my desired timezone depending on where I am connecting from. Is this possible?


title: What is a channel?

text: http://www.di.uevora.pt/~lmr/syscalls.html In that reference about system calls, appears a function called dup(). It is said that it duplicates channels. Then my question is, what is a channel?


title: Sort the output of find -exec ls

text: Is it possible to the output of `find … -exec ls -ls ;` sorted alpabetically, by filename? This is my cron command:               find /home/setefgge/public_html -type f -ctime -1 -exec ls -ls {} \;      This command works okay, for the most part. But the results are not sorted in any meaningful sequence. It would be very helpful if they would be sorted by the file name field.


title: HDMI output with HD 3000 only works with DVI output also in use

text: After moving to a new apartment I realized it was no longer practical to use my main desktop for my projector (Optoma HD100X) in the living room (the cable run would be crazy and I'd been planning on putting together an HTPC anyway). So, I ordered the necessary parts and put the whole thing together this friday. I went for an Asus P8H77-I motherboard and a Pentium G860 processor since that way I'd have integrated graphics and the motherboard comes with DVI, VGA, DP and HDMI outputs. Now, at first I hooked everything up to my main workstation's secondary monitor via the DVI port everything worked just fine. Then I moved the HTPC to my living room and hooked it up to the projector via a 10 meter HDMI cable. The projector shows the usual UEFI bootup stuff just fine and the GRUB boot menu shows up. Then once past that the projector stops receiving a signal. After a little testing I concluded that if I run the cable to my main desktop (iMac 27") and use a DP-to-HDMI adapter it works just fine. I also discovered that if I hook up my secondary monitor (also 1920x1080) to the HTPC at the same time as the projector is hooked up to it then I get an image on both the monitor and the projector. So in short:   * Main desktop + HDMI to projector => HDMI output to projector works   * HTPC + DVI to monitor => DVI output to monitor works   * HTPC + HDMI to projector => No HDMI output to projector   * HTPC + HDMI to projector + DVI to monitor => 1080p output to both monitor and projector (but trying to extend the desktop rather than just clone it results in both the monitor and the projector going blank) Now, I don't have a long enough DVI cable to test the projector with a DVI connection to the HTPC but I have a nagging suspicion that it would work just fine (projector is ceiling mounted so I'm not in any hurry to get it down just to test this). Does anyone have any experiences with a problem like this? For now I've left my secondary monitor sitting next to the HTPC so I can use the HTPC but I'd rather move it back to my main desktop). To me this seems like something I should be able to deal with in software. Right now the HTPC is running Debian (wheezy as the version of ALSA in squeeze didn't recognize the integrated sound card) although I've also tried Ubuntu and Fedora, Fedora had the exact same issue and with Ubuntu the Live image installer worked but it refused to give any video output at all (DVI or HDMI) after installing and rebooting. I should probably also note that running `Xorg -configure` (with X and gdm off, of course) results in an error that reads `Number of created screens does not match number of detected devices` and then it dumps out an Xorg file which looks a bit quirky, including that it is set to use the `vesa` driver. **Edit:** I just noticed that if I start the HTPC with the monitor connected but not turned on then both the projector and the monitor wind up reporting "No signal". I'm starting to think that there's some kind of handshake issue here... **Edit 2 (2012-11-22):** Posted an answer myself earlier thinking my problem was solved but now I'm having the same issue with the new HDMI cable. After a couple of reboots I stopped being able to get a video signal from the computer to the projector. I did however notice a pattern: If video output worked during initial stages of boot (UEFI, grub, Linux until X starts) then on the boot it will not work **at all** , not even for the EUFI splash screen. On those bootups where I get the UEFI splash screen I also get grub and debian booting right up to the point where it's about to switch to 1920x1080, then the projector just reports "no signal". So at this point I'd be happy with a way to force X to always drive the HDMI port @ 1920x1080 just to get this running reliably.


title: Directory sync across SSHFS involving symlinks

text: I have 2 Ubuntu Linux boxes with similar directory structures, LX02 and LX04. When I ssh from a terminal on LX02 to LX04 and go to my main scripting directory, /root/sbin, I see a different set of subdirectories than when I go the same directory from a terminal session on LX04. Why? **DETAILS**   Both machines have a /0 directory that contains mountpoint directories for each remote host as in...               /0/LX02     /0/LX04      /etc/fstab contains entries to mount the remote host's root (/) directory to these. There is a 'mount bind' entry to mount the local (/) directory which avoids special coding for the local host in scripts. /root/sbin is a symlink to /usr/local/sbin on each machine. _The local /root/sbin directory on LX02 looks like..._                root@LX02:/  cd /root/sbin           root@LX02:~/sbin  ls -l | grep '^d'          drwxr-x--- 2 root root  4096 2011-07-16 00:49 Archives-sbin-20110825     drwxr-x--- 2 root root  4096 2010-07-28 08:13 lst     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Misc     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Slates     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Tomboy     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Ubuntu_8.04     drwxr-x--- 2 root root  4096 2010-07-28 08:13 www     drwxr-xr-x 2 root root  4096 2012-09-27 12:48 zim      _Going to /0/LX04/root/sbin from an LX02 terminal session results in..._                root@LX02:/0/LX04/root/sbin  cd /0/LX04/root/sbin           root@LX02:/0/LX04/root/sbin  ls -l | grep '^d'          drwxr-x--- 2 root root  4096 2011-07-16 00:49 Archives-sbin-20110825     drwxr-x--- 2 root root  4096 2010-07-28 08:13 lst     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Misc     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Slates     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Tomboy     drwxr-xr-x 2 root root  4096 2012-04-11 09:28 Ubuntu_8.04     drwxr-x--- 2 root root  4096 2010-07-28 08:13 www     drwxr-xr-x 2 root root  4096 2012-09-27 12:48 zim      _However, the /root/sbin directory on LX04 actually looks like..._                root@LX04:/  cd /root/sbin           root@LX04:~/sbin  ls -l | grep '^d'          drwx------ 4 root root 12288 2011-12-23 03:23 Archives     drwx------ 2 root root  4096 2011-07-16 00:49 Archives-sbin-20110825     drwxr-xr-x 3 root root  4096 2012-11-14 00:22 Examples     drwxr-x--- 2 root root  4096 2011-04-29 13:50 fnc     drwxr-x--- 2 root root  4096 2011-05-19 15:00 lst     drwxr-xr-x 3 root root  4096 2012-10-28 10:01 Synergy     drwxr-x--- 2 root root  4096 2011-03-10 20:54 tmp     drwxr-x--- 2 root root  4096 2011-03-10 20:54 www      ### What's happening here?


title: mkisofs can't find file

text: I'm trying to create a .iso file using `mkisofs`. I have the following folders:               my OS     |     |--src     |--bin      I used the following command:               mkisofs -R -input-charset utf8 -b bin/boot.bin -no-emul-boot -boot-load-size 4 -o os.iso bin      the command was run from the parent directory (my OS) and I got the following error:               genisoimage: Uh oh, I cant find the boot image 'bin/boot.bin' !      I checked, and the file `bin/boot.bin` does exists. I tried writing `./` before the directory, and using real paths, but no good. Can any one help me?


title: Script to get file from SFTP and run it

text: We have 5 servers running our code: A, B , C, D and E. From a local machine, we sftp the file to A. Then               ssh id@A     su - applicationname     sftp id@A     get <file>     bye     tar -xzf <file>     logout     logout      The same procedure we apply for others B to E. Is there any way we can simplify this using script? We have requested linux team to provide passwordless authentication. But we don't know how to do sftp inside a SSH session using a script.


title: Keyboard layout changed. How and why?

text: Yesterday, I upgraded my kernel (to 3.5.0-19-generic), rebooted, and had to reinstall my video drivers to get full resolution. (After upgrading the kernel, the resolution always goes to 640x480, until I reinstall the drivers in Console Login). Now that I'm back in KDE (I didn't notice if it had changed in the Console Login), my keyboard layout has changed to the US format, so, for example `Shift`+`2` prints `@` instead of `"`. In KDE's System Settings -> Input Devices -> Keyboard -> Layouts, it seems to show the correct settings: Map=gb, Layout="English (UK)", Variant="English (UK, extended WinKeys), Label="gb". That's fine. I changed it and changed it back, and nothing has changed; it's still using the US layout. After a little googling, I found that there are X server settings, which I've found in `/etc/default/keyboard`. I've never edited this file before and its last modification (according to `ls -l`) was a month ago. But in there, `XKBLAYOUT="us"`. It also says:-               # If you change any of the following variables and X is configured to     # use this file, then the changes will become visible to X only if udev     # is restarted.  You may need to reboot the system.      I need to reboot? Seriously? Any idea what changed my keyboard layout, and/or how can I prevent this from happening again? Why don't the KDE settings take precedence? **UPDATE:** This must have been some sort of freak occurrence. Some of KDE's keyboard shortcuts I had configured, weren't working either. Changing XKBLAYOUT to "uk", and rebooting changed everything back to normal.


title: How do I trigger a script when a folder is updated in Solaris 5.10?

text: We are trying to write a script to move away files as soon as they drop in a folder. One way of achieving this is running rsync in a script on cron scheduler. The problem with this approach is the system overhead. We cannot run it every second and if we run it after an interval of time then we leave the files vulnerable (accessible to senders) for that time gap. Reqirement is that the files should vanish as soon as they arrive. I checked stackoverflow and found the incron command. But this is only available on Linux and not on Solaris.


title: What does Arch Linux offer?

text: I use Macs, Ubuntu, FreeBSD, OpenBSD, and Fedora for different purposes. I'm fairly busy and trying out a new distro takes a lot of time, but I hear lots of good things about Arch Linux from people I admire. I do mostly scientific computing (and some web development), and use Linux as both a desktop and a server. Does Arch offer anything I'm not already getting from one of my current installs? I'm particularly interested in the differences between Arch and Debian


title: count lines in a file

text: I'm sure there are many ways to do this: how can I count the number of lines in a text file?               $ <cmd> file.txt     1020 lines


title: Can I build a linux distro with libc instead of glibc

text: I recently had a conversation with a friend who is a highly skill software engineer, and he showed me some articles outlining the fact libc was much better than glibc. I wonder if its possible to use libc instead, and what kind of problems would I come up against if I went this route?


title: How to crop a particular part of a YouTube video clip?

text: Having an MPEG4 (MP4 container, H264 AVC video, AAC audio) video clip downloaded from YouTube, how to crop a particular piece of it (remove everything before a particular starting point timestamp an after a particular finish point timestamp) with free Linux tools? PS: I don't mind employing a patented or even a BLOB codec library.


title: Does Android really use the same kernel as Linux?

text: I read from somewhere that Android uses the Linux Kernel. Is it really true? I thought the Linux Kernel was meant for desktop operating systems.


title: How to grab the audio channel from an MP4 video file into a separate audio file?

text: Having an MPEG4 (MP4 container, H264 AVC video, AAC audio) video clip downloaded from YouTube, how to separate its audio channel into an independent audio (without de&re-compressing the audio preferably) file with free Linux tools?


title: NMAP probing VirtualBox Client

text: Cannot seem to probe virtual guests from the virtual host. **These guests can be probed from other devices on the same LAN/Network** , but not the host. I can understand why it might be struggling, but I am wondering if anyone ever found a way to make it work. HOST: OSX 10.6 GUEST: FreeBSD 8 (two of them) Edit: Adding some finer details, I have networking set to "bridged", I can ping and regularly consume services running on TCP/IP on both guests. All of my nmap probe attempts are done from the root account on the host.


title: SSH to a remote computer having only the public IP

text: Is it possible to connect to a computer behind a router via SSH knowing only the public IP address (of the router)?


title: How do I use SSH keys for passwordless SSH via X11 apps (like nautilus)?

text: I just reinstalled Linux on my laptop, and I'm trying to get SSH pubkey authentication working via X11 applications. Specifically, I'm trying to use `baobab` to display the usage of a remote filesystem, and I need to SSH in as root but root has no password, o I need to use an SSH key to authenticate. In the terminal, if I `ssh root@theserver` I get right in with no password, but if I use Baobab or Nautilus to connect, it asks me for my password. How can I have it use my SSH key? I'm using Gnome on Ubuntu 10.10 in case it matters. On my previous install this worked, and I don't know if I did something before to make it work. if so, I've forgotten what... In fact, my previous install would pop up an X11 dialog asking for my SSH private key password if I needed to unlock it. How do I make that happen again?


title: reference problem in using sed

text: I'm trying to use `sed` command to find/replace a pattern in file.   It gives:               sed: -e expression #1, char 27: invalid reference \1 on `s' command's RHS      My command is:               sed 's/"([A-Z]+)",/"\1","\L\1"/g' file.txt       What is the problem?   How can I fix it?


title: Find when the file was closed in Unix

text: I know `ls -l` will give the modified time of file, but it is giving the time when the file was opened, not closed (using `Ctrl`+`D` or something) Please tell me how to find the time of file closed               [BASH]$date     Wed May  7 10:33:01 EEST 2014     [BASH]$cat >aa     adf     adsf     #waited 8 mins before closing file (time of closing: 10:41)     [BASH]$ls -l aa     -rw-------    1 orclschd staff             9 May  7 10:33 aa     [BASH]$date     Wed May  7 10:41:47 EEST 2014     [BASH]$stat aa     bash: stat: command not found     [BASH]$uname     AIX       Here I have created a file named `aa`, The file was created at 10:33 but when I closed the file and I checked the file's modified date it still showed 10:33. But the file creation end date (closed time) is 10:41 . Is there is any command in AIX to find when the file is closed or can we write any bash script to track the file automatically?


title: Why does a software package run just fine even when it is being upgraded?

text: Say I am running a software, and then I run package manager to upgrade the software, I notice that Linux does not bring down the running process for package upgrade - it is still running fine. How does Linux do this?


title: Where does this convention for quotation marks (`` ...'') come from?

text: Frequently I get asked the question: > ``K., where does this convention for quotation marks come from? You know, > the one with the two grave accents introducing a quoted string and two > regular upright single quotation marks ending it?'' I have no idea. Where does this come from?


title: /proc/cpuinfo showing zero cpu clock speed

text: I saw an interesting issue where the `cpuinfo` file from `/proc` filesystem shows the cpu clock speed as zero. It is a physical host with no virtualization. Can someone explain to me some probable reasons behind this?               $ cat /proc/cpuinfo  | grep -i "cpu Mhz"     cpu MHz     : 0.000     cpu MHz     : 0.000     cpu MHz     : 0.000     cpu MHz     : 0.000      * * *               # dmidecode  | grep -A 20 CPU             Socket Designation: CPU1             Type: Central Processor             Family: Xeon             Manufacturer: Intel(R) Corporation             ID: D7 06 02 00 FF FB EB BF             Signature: Type 0, Family 6, Model 45, Stepping 7             Flags:                     FPU (Floating-point unit on-chip)                     VME (Virtual mode extension)                     DE (Debugging extension)                     PSE (Page size extension)                     TSC (Time stamp counter)                     MSR (Model specific registers)                     PAE (Physical address extension)                     MCE (Machine check exception)                     CX8 (CMPXCHG8 instruction supported)                     APIC (On-chip APIC hardware supported)                     SEP (Fast system call)                     MTRR (Memory type range registers)                     PGE (Page global enable)                     MCA (Machine check architecture)     --             Version: Intel(R) Xeon(R) CPU E5-2670 @ 2.60GHz             Voltage: 0.8 V             External Clock: 100 MHz             Max Speed: 4000 MHz             Current Speed: 2600 MHz             Status: Populated, Enabled             Upgrade: <OUT OF SPEC>             L1 Cache Handle: 0x0007             L2 Cache Handle: 0x0008             L3 Cache Handle: 0x0009             Serial Number: Not Specified             Asset Tag: Not Specified             Part Number: Not Specified             Core Count: 8             Core Enabled: 8             Thread Count: 16             Characteristics:                     64-bit capable          Handle 0x0005, DMI type 4, 42 bytes     Processor Information             Socket Designation: CPU2             Type: Central Processor             Family: Xeon             Manufacturer: Intel(R) Corporation             ID: D7 06 02 00 FF FB EB BF             Signature: Type 0, Family 6, Model 45, Stepping 7             Flags:                     FPU (Floating-point unit on-chip)                     VME (Virtual mode extension)                     DE (Debugging extension)                     PSE (Page size extension)                     TSC (Time stamp counter)                     MSR (Model specific registers)                     PAE (Physical address extension)                     MCE (Machine check exception)                     CX8 (CMPXCHG8 instruction supported)                     APIC (On-chip APIC hardware supported)                     SEP (Fast system call)                     MTRR (Memory type range registers)                     PGE (Page global enable)                     MCA (Machine check architecture)     --             Version: Intel(R) Xeon(R) CPU E5-2670 @ 2.60GHz             Voltage: 0.8 V             External Clock: 100 MHz             Max Speed: 4000 MHz             Current Speed: 2600 MHz             Status: Populated, Enabled             Upgrade: <OUT OF SPEC>             L1 Cache Handle: 0x000B             L2 Cache Handle: 0x000C             L3 Cache Handle: 0x000D             Serial Number: Not Specified             Asset Tag: Not Specified             Part Number: Not Specified             Core Count: 8             Core Enabled: 8             Thread Count: 16             Characteristics:                     64-bit capable          Handle 0x0006, DMI type 7, 19 bytes     Cache Information     --             Designation: SLOT1_PCIE_G3_X16(CPU1)             Type: x16 <OUT OF SPEC>             Current Usage: Available             Length: Long             Characteristics:                     3.3 V is provided                     Opening is shared                     PME signal is supported                     Hot-plug devices are supported          Handle 0x0015, DMI type 9, 17 bytes     System Slot Information             Designation: SLOT2_PCIE_G3_X16(CPU1)             Type: x16 <OUT OF SPEC>             Current Usage: Available             Length: Long             Characteristics:                     3.3 V is provided                     Opening is shared                     PME signal is supported                     Hot-plug devices are supported          Handle 0x0016, DMI type 9, 17 bytes     System Slot Information             Designation: SLOT3_PCIE_G3_X8(CPU2)             Type: x8 <OUT OF SPEC>             Current Usage: Available             Length: Long             Characteristics:                     3.3 V is provided                     Opening is shared                     PME signal is supported                     Hot-plug devices are supported          Handle 0x0017, DMI type 9, 17 bytes     System Slot Information             Designation: SLOT4_PCIE_G3_X16(CPU2)             Type: x16 <OUT OF SPEC>             Current Usage: Available             Length: Long             Characteristics:                     3.3 V is provided                     Opening is shared                     PME signal is supported                     Hot-plug devices are supported          Handle 0x0018, DMI type 10, 6 bytes     On Board Device Information             Type: Video             Status: Enabled             Description: ASPEED Technology, Inc. AST GPU 0.96.00 (VGA1)          Handle 0x0019, DMI type 10, 6 bytes     On Board Device Information             Type: Ethernet             Status: Enabled             Description: LOM 1G I350-BT2 (LAN1)     --             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 36119A9B             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x001F, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_A5             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x0020, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x002F             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_A2             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 36119ADA             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x0021, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_A6             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x0022, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0030             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_A3             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 3611991C             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x0023, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_A7             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x0024, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0031             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_A4             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 361196BF             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x0025, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_A8             Bank Locator: CPU1             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x0026, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0032             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_B1             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 36119A9C             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x0027, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_B5             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x0028, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0033             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_B2             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 36119696             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x0029, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_B6             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x002A, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0034             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_B3             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 361196C0             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x002B, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_B7             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x002C, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: 0x0035             Total Width: 64 bits             Data Width: 64 bits             Size: 16384 MB             Form Factor: DIMM             Set: None             Locator: DIMM_B4             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: 1333 MHz (0.8 ns)             Manufacturer: CE00B304CE00             Serial Number: 36119AD8             Asset Tag: 02171321             Part Number: M393B2G70BH0-YH9          Handle 0x002D, DMI type 17, 34 bytes     Memory Device             Array Handle: 0x001D             Error Information Handle: Not Provided             Total Width: Unknown             Data Width: Unknown             Size: No Module Installed             Form Factor: DIMM             Set: None             Locator: DIMM_B8             Bank Locator: CPU2             Type: <OUT OF SPEC>             Type Detail: Synchronous             Speed: Unknown             Manufacturer: NO DIMM             Serial Number: NO DIMM             Asset Tag: NO DIMM             Part Number: NO DIMM          Handle 0x002E, DMI type 18, 23 bytes     32-bit Memory Error Information             Type: OK             Granularity: Unknown             Operation: Unknown             Vendor Syndrome: Unknown             Memory Array Address: Unknown             Device Address: Unknown             Resolution: Unknown          Handle 0x002F, DMI type 18, 23 bytes     32-bit Memory Error Information      * * *               # lscpu     Architecture:          x86_64     CPU op-mode(s):        32-bit, 64-bit     CPU(s):                16     Thread(s) per core:    1     Core(s) per socket:    8     CPU socket(s):         2     NUMA node(s):          1     Vendor ID:             GenuineIntel     CPU family:            6     Model:                 45     Stepping:              7     CPU MHz:               0.000     Virtualization:        VT-x     L1d cache:             32K     L1i cache:             32K     L2 cache:              256K     L3 cache:              20480K


title: How can I print lines from file backwards (without using "tac")?

text: I have a simple question (I think). I want to print lines from a file backwards without using `tac` command. Is there any other solution to do such thing with bash?


title: WhenI try to run in the terminal, I get the error:

text: when I try to run in the terminal, I get the error `The command could not be located because '/usr/bin' is not included in the PATH environment variable`. e..g.               jeper@jeper:~$ clear     Command 'clear' is available in '/usr/bin/clear'     The command could not be located because '/usr/bin' is not included in the PATH environment variable.     clear: command not found      and like               jeper@jeper:~$ vi     Command 'vi' is available in '/usr/bin/vi'     The command could not be located because '/usr/bin' is not included in the PATH environment variable.     vi: command not found      What is the issue is and what is the way to resolve it?


title: List a directory but only if it contains sub-directories?

text: In Unix, is it possible to use one command ONLY to list directories if they contain a sub-directory? For example, I would like to list the directory name if it contains a sub- directory called "division_A":               /data/data_file/form_100/division_A     /data/data_file/form_101/division_A     /data/data_file/form_102/division_A      The expected result would be:               form_100      form_101      form_102      I can only use 2 command lines to realize the goal.               cd /data/data_files     echo `ls -d */division_A 2> /dev/null | sed 's,/division_A,,g'`      So I would like to ask if anyone can use one command to proceed it.


title: What's the approximate percentage of Linux servers in the world?

text: I did so many searches on search engines, but could not find a relevant solution. Is there any research or source that shows an approximate value for servers?


title: RAM for Kali Linux 1.0.9 VMWare 32 bit (i486)

text: How much RAM is the Kali Linux 1.0.9 VMWare 32 bit (i486) pre-configured to use. I have been searching on Google and various sites and cannot find the answer. I have limited, slow internet and need to know how much RAM it is pre- configured with so I can make sure to purchase the correct hosting account with the necessary amount of RAM to make sure the image works correctly. The direct download link is here, but the first link I posted lists all the available images.


title: Arch linux : pacman does not work when chrooting

text: I have Ubuntu installed on my computer. I decided to install Arch linux, but I skipped the part about Grub installation as it is already installed. Seeing that Arch does not show up in Grub's menu list, I decided to install it in Arch. I mounted Arch's partition in Ubuntu and I chrooted into it. I issued the command `pacman -S grub-bios` and got the following :               error: could not open file: /etc/mtab: No such file or directory     error: could not determine filesystem mount points     error: failed to commit transaction (unexpected error)     Errors occurred, no packages were upgraded.      `/etc/mtab` is a symlink to `/proc/self/mounts`, but there is nothing in the `/proc` folder. What am I doing wrong? As a complement, am I going in the right direction to make Arch appear in Grub's list? **EDIT** : I was able to make Arch appear in Grub's list from Ubuntu by doing `sudo mount /dev/sdaX` ( _replace X with Arch's partition number_ ) before `sudo update-grub`.


title: Filesystems and Partitions

text: I have been reading up more on UNIX and have brushed up on different filesystems and partitioning HDs. In the book it mentioned that filesystems are very much different than partitions and one shouldn't misconstrue one for the other. Can someone explain why mistaking one for the other is wrong and what would be a good explanation separating one from the other


title: Sync Linux between two computers

text: I have Mint Linux installed on my Computer at home, on my Laptop and on a bootable USB3 stick. I would like these three systems to be completely identical when I get home. For example: I work on my Desktop at home. Before I leave to work I start some kind of script/application which pushes all changes to the USB stick and Laptop. When I get home from work (used the laptop all day) I would like to start the script/application but this time it pushes all changes from the Laptop to the Desktop and USB stick. And of course if I used the USB stick at a friends place for example I would like to sync everything from it to the two computers. I actually I don't need a sync, I need more of a push because I won't be working on more than one of these simultaneously. Is this possible?


title: Remove characters in pattern of words

text: I have sentences with words that have a pattern such as `p.G345L` and `p.X31Z`. I need to remove `p.` so I get `G345L` and `X31Z`.


title: Having error during Ubuntu installation

text: I have Ubuntu on a USB stick. When I boot from it (select boot from this USB), it shows some logs like usual. I also see the Ubuntu logo with 5 dots below, but then I get these:               ext2_lookup deleted inode referenced XXXX       And I get tons of them, whole screen is flooded with them. What should I do to resolve this?   1. I am using USB 3.0    2. I am using Windows 7 Ultimate 32-bit   3. I have a 64-bit capable processor   4. I have never installed Linux on this computer


title: How to start a webserver with systemd?

text: I copied this this file (vokabel_daemon.service)               [Unit]     Description=Start vokabeltrainer daemon     After=network.target          [Service]     ExecStart=/home/mm/lib/vokabeltrainer/box_vokabeltrainer.pl daemon --listen "http://*:3001"          [Install]     WantedBy=mulit-user.target       to `/etc/systemd/system/` (openSUSE12.1). Then after a               systemctl enable vokabel_daemon.service     systemctl start vokabel_daemon.service      I could open my website. But after a reboot it doesn't work any more. `systemctl status vokabel_daemon.service`:               vokabel_daemon.service - Start vokabeltrainer daemon               Loaded: loaded (/etc/systemd/system/vokabel_daemon.service; enabled)               Active: inactive (dead)               CGroup: name=systemd:/system/vokabel_daemon.service      After a `systemctl start vokabel_daemon.service` it is working again:               vokabel_daemon.service - Start vokabeltrainer daemon               Loaded: loaded (/etc/systemd/system/vokabel_daemon.service; enabled)               Active: active (running) since Thu, 21 Jun 2012 08:38:16 +0200; 1s ago             Main PID: 2288 (perl)               CGroup: name=systemd:/system/vokabel_daemon.service                       └ 2288 perl /home/mm/lib/vokabeltrainer/box_vokabeltrainer.pl daemon --listen http://*:3001      What do I have to change so that I don't have to start the daemon by hand after a reboot?


title: Sarg report error

text: I have a proxy server that runs Ubuntu Server 11.10, Squid 2.7.STABLE9. I installed sarg (version 2.3.1 Sep-18-2010) to generate reports using the ordinary apt-get install, and added a cron job to generate a report of the day every 5 minutes (that will overwrite the 5-minutes-older one):               */5 * * * * /root/proxy_report.sh      And the content of `/root/proxy_report.sh` is:               #!/bin/bash     /usr/bin/sarg -nd `date +"%d/%m/%Y"` > /dev/null 2>&1      And I added another cron job to generate a full report every hour at :32 (not to collide with the 5 minutes job):               */32 * * * * /root/proxy_report_full.sh      And the content of `/root/proxy_report_full.sh` is :               #!/bin/bash     /usr/bin/sarg -n > /dev/null 2>&1      And I added a small script to remove the yesterday full report (the full report that ends in yesterday that won't be overwritten by the new today full report) in `/etc/rc.local` to run at startup:               /usr/bin/rm_yesterday.sh &>> /var/log/rm_yesterday      Where `/usr/bin/rm_yesterday.sh`:               #!/bin/bash     find /var/www/sarg/ | grep `date -d Apr1 +"%Y%b%d"`-* | grep -v `date +"%Y%b%d"` | xargs rm -rf      * Apr1 is the starting date of the proxy... ** I've placed it in `/usr/bin` to be mounted early at startup... That arrangement went OK for about a month and a half, except for one time I noticed some errors and reports wasn't generated, and fixed that by making an offset (the two minutes in 32 of the second cron job). However, it then started not to generate reports anymore. By manually trying to generate it it gives the following error:               root@proxy-server:~# sarg -n     SARG: getword_atoll loop detected after 3 bytes.     SARG: Line="154 192.168.10.40 TCP_MISS/200 39 CONNECT www.google.com"     SARG: Record="154 192.168.10.40 TCP_MISS/200 39 CONNECT www.google.com"     SARG: searching for 'x2f'     SARG: getword backtrace:     SARG: 1:sarg() [0x8050a4a]     SARG: 2:sarg() [0x8050c8b]     SARG: 3:sarg() [0x804fc2e]     SARG: 4:/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x129113]     SARG: 5:sarg() [0x80501c9]     SARG: Maybe you have a broken date in your /var/log/squid/access.log file      When I looked to `/var/log/squid/` folder, I noticed that it contains some rotated logs:               root@proxy-server:~# ls /var/log/squid/     access.log  access.log.1  cache.log  cache.log.1  store.log  store.log.1      So maybe sarg installed logrotate with it? Or it comes with the standard Ubuntu? I don't remember I installed it manuallly. **The question is** : What could've gone wrong? Does it have something to do with rotating the log? How can I trace the error and start generating reports again?


title: Exporting just a single file

text: To make scripts accessible from anywhere in the terminal, one can use the following sequence of commands:               PATH=$PATH:some_path_here     export PATH      Which includes all files at the path sent in alongside all of its subfolders. Which means from then on just typing the name of a script stored within this folder structure will execute it. How do I export only a single file this way instead of an entire folder alongside all its subdirectories?


title: FreeBSD USB devices - given /dev/da* device is on which speed?

text: I use machine with USB 2 and USB 3 ports, and I have USB 3 external disk which works perfectly in term of speed (I use it as backup drive so during the night new files are nicely transfered to this external drive). Now I try to do simple script to check if USB drive connected to the right (USB **3** ) port, and not slow USB 2. Easy to say, but... The disk is WD's Elements series, and `camcontrol devlist` tells me:               ...     <WD Elements 1042 1007>            at scbus11 target 0 lun 0 (pass9,da1)     ...      Ok, it shows the device (da1), but it won't tells me the speed. At the same time `usbconfig` shows me:               ...     ugen1.2: <Elements 1042 Western Digital> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON     ...      Here I see speed ("spd=SUPER (5.0Gbps)"), but I see no way to understand if this "Elements 1042 Western Digital" is the same "WD Elements 1042 1007" from above command. So could please tell me if there is any way to clearly get given **da** 's speed?


title: Writing usb on FreeBSD to access on windows

text: How can I write "stuff" into USB drive on FreeBSD such that, the "stuff" is accessible in Windows [ _yes my wife still uses that :(_ ] and Ubuntu?


title: LMDE, Graphics with i915 and KMS: DVI not working on tty consoles

text: I already asked the same question at Super User, but I think it's better suited here, sorry: I have some problems getting the DVI output of my onboard Intel graphics device running when using KMS. VGA works fine. For X.org I was able to get everything running as it should using some xrandr commands being executed when gdm3 starts. Unfortunately I still had no luck in enabling the DVI output during boot and shutdown process or when I switch to a tty console using CTRL+ALT+Fn. I enabled KMS in `/etc/modprobe.d/i915-kms.conf` but it's the same behaviour when I use `i915.modeset=1` as a boot parameter in grub2. I tried enabling the DVI output via the video parameter passing `video=DVI1:e` as well as `video=DVI1:1680x150@60e` what are the corrent settings for my monitor. Still no luck. When I disable KMS or pass `acpi=off`to the kernel what seems to have the same effect I get the video output from DVI but of course have other drawbacks. I'm using LMDE running kernel `3.2.0-2-486 (Debian 3.2.9-1)` but already tried a 2.6.somewhat version. Any ideas how to enable DVI output even _outside_ X?


title: Editing Adobe PageMaker (.pmd) files in debian

text: I'm using Linux-Mint-Debian as my primary (only) OS and would like to **edit** Adobe PageMaker (.pmd) files on it. I've read that Scribus is the open-source alternative for PageMaker on linux, but I'm not sure if it has a plugin for pmd files. How can I edit a pmd file in Debian?


title: How to know reason of a process going to sleep state and wake it up?

text: When I do 'top' , I see my perl script process in 'S' state. Is there a way to know, what is making this perl process go in sleep state and ways to wake it up? Any way to debug to give more insights on lines in perl script making it go in 'S' state.


title: all type of image files stop loading

text: I am working on my newly installed wine. when i tried to run a game , called "road rash" through wine, my screen resolution got change and after few seconds game stop working. Then my most of image files including desktop icons and background disappeared. when i try to view any image through "image viewer", it shows "Could not load image" error. Though i have removed "wine" and restarted system, but same thing is happening. following is my system configuration: OS:Fedora 15 (gnome 3.0.1) OS-type : 64 bit Memory : 3.8 GB Processor: AMD Athlon(tm) X2 240 Processor × 2 Graphics : Gallium 0.4 on NV4C for your reference I have executed "dmesg" command and errors are pasted in following link: http://pastebin.com/raNYtK3x


title: Calling a function which calls another function with a for loop

text: I am calling a function with a `for` loop and saving the returned value to a variable. When I run the code, I get a `command not found` error. What is wrong?               #!/bin/bash          check_1()     {         x_$1=$(check_2 $1)     }     check_2()     {         ans=$((3+$1))         echo $ans     }     for((i=1; i<=2;i++))     do       check_1 $i       tmp=x_$i       echo ${!tmp}     done      If I run the script above I get:               sample.sh: line 5: x_1=4: command not found     sample.sh: line 5: x_2=5: command not found


title: dot instead of comma as thousand separator

text: I read about `\--blocksize` for `ls` to get a thousands separator. However my computer gives me dot (`.`) and not comma (`,`):               $ ls -l --block-size="'1"     total 11.893.190.656     -rw------- 1 carlah users  1.081.192.448 Apr 16  2013 D1.vdi     -rw-rw-r-- 1 carlah users             37 Apr  3  2012 interface.txt     -rw------- 1 carlah users     86.052.864 Apr 16  2012 D2.vdi     drwx------ 2 carlah users          4.096 Apr 16  2012 Snapshots/     -rw------- 1 carlah users 10.725.925.376 Apr 16  2012 Vista.vdi      I tried `LC_NUMERIC=en_US ls -l --block-size="'1"` to change that but that did just remove the dots not turn them into commas. Am I doing something wrong?


title: Obtain values of a section of a file

text: I have a configuration file in the following format.               <Title>      [part1]       A.File = a       A.Val = val1       B.File = a       B.Val = val1      [part2]       A.File = a1       A.Val = val2        B.File = a       B.Val = val1      I want to extract values from first part only.                #!/bin/sh      getCalibDate()     {      file="/path/of/config/file"      value=`cat ${file} | grep Val | cut -d'=' -f2`         for v in $value         do                 echo $v         done     }     getCalibDate      Above script will return all the values. How can I get values from only first part (part1) ?


title: Create a directory if it doesn't exist in TCL

text: I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory `/var/cti/adm/APP` exists. If APP not exists under `adm` directory , then need to create this directory and add ownership to this directory , ( as chown system ) Please advice how to check if directory exist in expect script and if not need to create this directory example of part of my expect script                #!/usr/bin/expect -f      set multiPrompt {[#>$]}      send "ssh  $LOGIN3@$IP\r"      sleep 0.5            expect  {            word:  {send $PASS\r ; exp_continue }             expect -re $multiPrompt            }      example how we can do it with bash                [[ ! -d /.../..../... ]] && mkdir -p xxxxx


title: Display stuff below the prompt at a shell prompt?

text: Lets's say my prompt looks like this (the _ represents my cursor)               ~ % _      Is there any way I could make it look like this               ~ % _     [some status]      _The question was originally about zsh, but now has other answers._


title: Mounting LUN in AIX

text: I have LUN created and added to AIX, I know this because once I created the LUN and the name I gave in the IBM storage is displayed and also I used the following commands               chdev -l hdisk7 -a pv=yes      then               cfgmgr -i disk      Now when I type lspv i can see the hdisk7 fully initialized. But the question now is how to mount this to a folder?


title: What rescue disk (rescue CD/DVD) to recover data from failed HDD would you recommend for first time user?

text: What rescue disk (rescue CD/DVD) would you recommend for an user which unfortunately needs to rescue data from a bad disk (filesystems does not mount when using LiveCD, though fdisk looks O.K.) for a **very first time**? System does not boot from HDD: grub prints               error: attempt to read or write outside of disk 'hd0'     grub rescue>      When trying to use e2fsck, or mount filesystem, or just list metadata with tune2fs I get:               $ sudo tune2fs -l /dev/sda6     tune2fs 1.42.5 (29-Jul-2012)     tune2fs: Attempt to read block from filesystem resulted in short read              while trying to open /dev/sda6     Couldn't find valid filesystem superblock.      Fortunately booting from LiveCD works (I am writing this from Lubuntu 12.10 LiveCD).


title: Free space showing problem in `parted` command?

text: I tried to partition disk (HDD) into several parts for Windows and Linux by `parted`, but I find some problem as follows:   * Why doesn't the free space between `#3` and `#5` start from `106815488s` to `106817535s`?   * Why doesn't free space show after `/dev/sda5`, `/dev/sda7`, `/dev/sda9`, and `/dev/sda10`? ![Screenshot](http://i.stack.imgur.com/IP3KT.png)


title: Selectively forward email based on domain?

text: I have an alias on my mail server, call it `splitusers`. Based on which domain (a couple are run off one mail server) is used, I would like the mail forwarded to a different user account. Eg: > `splitusers@first.tld` should forward to `firstuser@first.tld`   >  `splitusers@second.tld` should forward to `seconduser@second.tld` How can I accomplish this? Is `procmail` the right approach? If so, what would the recipe look like?


title: how to configure postgresql to log in remotely and locally

text: In order to be able to connect to my postgresql database from another machine, I had to configure my `postgresql.con`f file like so:               #------------------------------------------------------------------------------     # CONNECTIONS AND AUTHENTICATION     #------------------------------------------------------------------------------          # - Connection Settings -          listen_addresses = '10.14.4.4'                # what IP address(es) to listen on;                                             # comma-separated list of addresses;                                             # defaults to 'localhost'; use '*' for all                                             # (change requires restart)     port = 5432                             # (change requires restart)      I tried using 127.0.0.1 but that didn't work. Neither did "localhost". The only way I was able to do make this work is to use the actual IP address of the server. I checked to make sure in my "hosts" file, localhost was defined.... In any case, I am now able to connect from a different server by doing the following:               psql -U test test -h 10.14.4.4      But now I'm noticing that I cannot log on **locally** using the following syntax:               psql -U test test -h 127.0.0.1      The only way to log in locally is               psql -U test test      I tried to change my postgresql.conf file to use "*"... and that let's me log in remotely, but locally, i still cannot use 127.0.0.1 or "localhost" to connect. How can I set this up so that both my remote logins and my local logins work?


title: Denyhosts will ban IPs from outside the LAN, including the router?

text: Provided I don't mess up, I can log in with `ssh` just fine from within my LAN. The router is your run of the mill home linksys router hooked to a modem that I enabled port forwarding on along with a reserved IP for my server. My first attempt to login (at the time I was using public key authentication) from a remote location I get banned. I looked at `/var/lib/denyhosts/hosts.restricted` it lists 192.168.0.1 and a couple of outside IPs from my attempts at logging in. What setting do I need to look at to fix this?


title: How can I tell echo/printf in Bash to swallow escape codes, based on a condition?

text: I have a Bash script that is being run interactively and as a `cron` job. When run interactively it outputs colored text on the terminal. However, when run in `cron` it doesn't have a terminal and therefore I get plenty of `[1;31m` and similar in the output. Is there a way in Bash to tell it to swallow the escape codes if the output device doesn't support them? This is related to How to check if bash can print colors which is about checking the condition. However, I want to change as little as possible in the invocation of `echo` or `printf` while retaining the dual functionality of colors or not depending on the output device.


title: Install opengl driver on RHEL5.7

text: A user is using a software called "HyperLynx - LineSim" to plot a graph. When he wants to view the graph, there's this error "Failed to run PowerScope: OpenGL is not installed". ![enter image description here](http://i.stack.imgur.com/AeAko.jpg) The machine is running RHEL5.7, and it using embedded graphic card.               # lspci -v|grep -i vga     01:06.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27) (prog-if 00 [VGA controller])      I googled but doesn't get anywhere further. Does anyone know how to fix this error and where I can download the OpenGL rpm for this OS? Thank you.


title: How to execute a program when a text file is called and still return the proper text

text: The question is fairly simple. I want to create a program that would hook the VFS and run the program in order to generate or read the data that would be create. I.E.: the file itself would hold all past revisions, hashes, data, and editors of its various versions. But in a normal call to the file (ala gcc sourcefile.c, vim readme.txt the file would read/write) like a normal text file. I figure I would have to hook the VFS to do so, and treat my file more like a 'special file' in the file system so it didn't act normally and instead calls the program in question which actually reads and outputs the files data. But I'm wondering where I would start with documentation on such a project the first several google searches and phone a friends have failed.


title: du on ramdisk displays 3GB less than df

text: I understand there's often a some discrepancy between du and df but when I du my ramdisk it occupies 13G, whereas df shows it's using 16GB. This seems quite a big difference. Is this normal?               [root@zserver2 ramdisk]# du -h .     ...     13G .          [root@zserver2 ramdisk]# df -h     Filesystem            Size  Used Avail Use% Mounted on     ...     none                   16G   16G     0 100% /home/stuff/ramdisk      The ramdisk is defined in fstab and defaults to 50% of my 32GB ram:               # cat /etc/fstab     ...     none             /home/stuff/ramdisk   tmpfs   mode=774,uid=500,gid=501  0     0


title: Real time system info script using ncurses and dialog

text: I'm trying to create a simple bash script that I can run over ssh that will display some basic system information using ncurses and the dialog command. I've tried two approaches so far: 1) Run `dialog --infobox` in a while loop with a 1 second sleep between redraws. Problem: This displays properly however there is a brief flicker between redraws that I would like to eliminate 2) Run `dialog --tailbox` once and have it display the contents of a pre- populated system info file. Problem: Unless the number of lines in the input file changes, the dialog doesn't update. I'm wondering if there is a better way to draw a dialog box with constantly updating information. I'm also open to any other non ncurses suggestions if there is a better/easier way of doing this. I will be displaying this through SSH on a small tablet so I would like to make it as visually appealing as possible while remaining within the terminal.


title: What is the difference between these two sudoers lines?

text: > **Possible Duplicate:**   >  What is the proper sudoers syntax to add a user? What is the difference between these two lines of /etc/sudoers:   * `USERNAME ALL=NOPASSWD:ALL`   * `USERNAME ALL=(ALL) NOPASSWD:ALL` ? (To me when I have only ever used sudo as a convenience function. To me sudo is the same exact thing as doing: `su;EXECUTE_A_COMMAND;exit;` but sudo lets you do it in 1 line instead of 3. I have never used sudo for anything else... so I don't really understand the subtlety seen here.)


title: lp command can’t open samba url

text: I have a Linux host with Samba installed and a Windows server with some Files. Samba is set up correctly and works just fine. I can show PDFs from the Windows server with               evince "smb://SRV/Share/.../xx.pdf"      but when I want to print this file with               lp –d lpX "smb://SRV/Share/.../xx.pdf"       an error occurs:               lp: Error – Access ?smb://SRV/Share/.../xx.pdf? not possible - File or Directory not found      Why do I get this error?


title: What is the meaning of this test expression

text: I have been reading the man pages for test(1), bash(1) and dash(1), but I can't figure out the meaning of this test :               [ `echo hi` > /dev/null ]      According to the man pages, there are two types of conditional expressions, primary and combined. Combined expressions are expressions combined of primaries. I've gone through the list of primaries and none matches the syntax of the above expression. Can someone break it down for me?


title: Have Bash script wait for status message before continuing

text: I'm firing up Selenium server with a bash script and as you can see from the timestamps on the log below, it takes about 32 seconds for the thing to fully come online:               Feb 28, 2012 10:19:02 PM org.openqa.grid.selenium.GridLauncher main     INFO: Launching a standalone server     22:19:02.835 INFO - Java: Sun Microsystems Inc. 20.0-b11     22:19:02.836 INFO - OS: Linux 2.6.32-220.4.1.el6.x86_64 amd64     22:19:02.852 INFO - v2.19.0, with Core v2.19.0. Built from revision 15849     22:19:02.988 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub     22:19:02.990 INFO - Version Jetty/5.1.x     22:19:02.992 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]     22:19:02.993 INFO - Started HttpContext[/selenium-server,/selenium-server]     22:19:02.993 INFO - Started HttpContext[/,/]     22:19:34.552 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@488e32e7     22:19:34.552 INFO - Started HttpContext[/wd,/wd]     22:19:34.555 INFO - Started SocketListener on 0.0.0.0:4444     22:19:34.555 INFO - Started org.openqa.jetty.jetty.Server@7d29f3b5      Instead of using a "sleep 32" command after starting the server (to delay the script before moving on), I'd like my bash script to wait until it sees the string "Started SocketListener", and then continue. Is that possible?


title: Graceful way to kill process

text: After my bash script is done with the selenium server, the script kills it like this:               kill `ps -ef | grep selenium | awk '{ print $2 }'`      While this works and it does kill the selenium script, it also tries to kill the process for `grep selenium` So by the time that process number gets back to the kill command, the process is gone, so it ends up generating an error message. (In other words: it ends up killing two processes, one of them is the real selenium server, the other is a fleeting process that is a side-effect of how I'm doing this command.) Is there a more graceful way to kill the process, that doesn't have this unintended side-effect? (FWIW one idea I had: this same script starts up selenium earlier in the script, so maybe if there was a way I could capture the PID when I start up selenium, I could just keep that and kill it directly, instead of grepping for the process ID. The problem is, I don't know how to get that PID, how to use a variable to keep it and how to reference it later in the script. But is that a better way to go about it?)


title: sigaction(7): semantics of siginfo_t's si_code member

text: I've got a long-running program (becomes a daemon with daemon(3) call) that exits on Signal 11 (Segmentation Violation) every so often. I can't tell why. So, I wrote a SIGSEGV handler, set using the `sigaction()` system call. I set the handler function so that it has this prototype: `void (*sa_sigaction)(int, siginfo_t *, void *)` which means it gets a pointer to a `siginfo_t` structure as a formal argument. On the occasion of a mysterious SIGSEGV, the `si_code` element of the `siginfo_t` has a value of 0x80, which means, according to the sigaction man page, "The kernel" sent the signal. This is on a Red Hat RHEL system: `Linux blahblah 2.6.18-308.20.1.el5 #1 SMP Tue Nov 6 04:38:29 EST 2012 x86_64 x86_64 x86_64 GNU/Linux` Why does the kernel send a SIGSEGV? Is this from the famed OOM-Killer, or does some other reason exist for getting a SIGSEGV? As a mere user on this system, I can't see `/var/log/message`, and the sysadmins are more than a bit aloof, probably because they come from a Windows background. A SIGSEGV generated on purpose (dereferencing a NULL pointer) does not get an `si_code` value of 0x80, it gets 0x1, which means "address not mapped to object".


title: Why are there 2048 sectors of free space between each logical partition?

text: I know about the advanced format and setting 2048 free sectors at the beginning of a disk. But I just converted a partition table of my disk from MS-DOS to GPT, and I noticed this: Before:               Number  Start   End     Size    Type      File system     Flags             32,3kB  1049kB  1016kB            Free Space      1      1049kB  31,5GB  31,5GB  primary   ntfs                  2      31,5GB  43,0GB  11,5GB  primary      3      43,0GB  44,1GB  1074MB  primary   linux-swap(v1)      4      44,1GB  80,0GB  36,0GB  extended      5      44,1GB  54,6GB  10,5GB  logical      6      54,6GB  65,0GB  10,5GB  logical   ext4            boot      7      65,0GB  80,0GB  15,0GB  logical             80,0GB  80,0GB  56,8kB            Free Space      After:               Number  Start   End     Size    File system     Name                  Flags             17,4kB  1049kB  1031kB  Free Space      1      1049kB  31,5GB  31,5GB  ntfs            Microsoft basic data  msftdata      2      31,5GB  43,0GB  11,5GB                  Linux filesystem      3      43,0GB  44,1GB  1074MB  linux-swap(v1)  Linux swap             44,1GB  44,1GB  1049kB  Free Space      5      44,1GB  54,6GB  10,5GB                  Linux filesystem             54,6GB  54,6GB  1049kB  Free Space      6      54,6GB  65,0GB  10,5GB  ext4            Linux filesystem             65,0GB  65,0GB  1049kB  Free Space      7      65,0GB  80,0GB  15,0GB                  Linux filesystem             80,0GB  80,0GB  39,9kB  Free Space      As you can see, there's 3 additional gaps there (2048 sectors), each for one extended partition. There's no gaps between 1st and 2nd, and 2nd and 3rd partition. Does anyone know why the gaps exist only between logical partitions?


What are the platforms that Linux is being used frequently on besides x86? I know that x86 dominates. But, what are other platforms that some people also use Linux for? Are there links for statistics about this?


title: Searching for all the array elements in another array?

text: This is how I would search for an element in an array.               count=${#ARRAY[@]}          lsearch()     {       status=-1            for((i=0;i<count;i++))       do          Temp=$1               if [[ $Temp -eq ${ARRAY[i]} ]]            then              status=0              searches=$((i+1))              return          fi        done     }      Suppose I need to look for all the elements of an array say `(a b c d)` in another array `( a h c d l k)`. Now for each element in one array I need to loop over the other array with a for loop. Is there any better way?


title: i/o format with printf in bash-shell

text: I am trying to output the results of my shell script using printf. To keep the results aligned in column, I am using tab as:               printf "%s\t %s\t %s\t %s\t %s\t %s\t %s\n" $i $est $var_m $jk $mst $var_M  $Tes >>tmp      But the problem is, for some cases, the results are bit long, as a output of say,               var_M=`echo "scale=8;(-1/$jk + (e(2*$jk)+1)/(e(2*$jk)-1))"|bc -l `      So, it will be better for me, if I can format print to the column, something like:               printf "%s *goto column 20* %s *go to column 30* " $i $est >>tmp      is this possible? I have checked this thread and also the man pages, but failed to find it. Is this possible? NB: I do not have any special reason to stick to printf. so any other suitable command that can do the thing (easily) is also welcome. **EDIT:** tried: `printf "%-2s %-8s\n" $i $est >>tmp` which is not clearly working:               4.0 0.17169E-02     5. 0.17156E-02     10. 0.17129E-02      (The 2nd row/2nd column is not aligned, just like the case of list-formatted output)


title: Removing lines based on tags for different files and merging into single file

text: I have to develope unix script in such way it should meet below scenario. I have 3 text files, 1.txt , 2.txt and 3.txt Data in those files as below.               HDR|1|2|3|||||||||||||||||||||||     DTL|||||||||||||||||||||||||||||||     DTL|||||||||||||||||||||||||||||||     TLR|||||||||||||||||||||||||||||||      For the first file (`1.txt`), we have to remove line based on TLR tag. For the second file (`2.txt`), we have to remove lines based on both TLR and HDR. For the 3rd file (`3.txt`), we have to remove line based on HDR tag. After doing above operation I have to put those three files data into single file. Here we are not sure how many files we get to merge it.we cannot directly hard code file names (like above 3 text files). How can we achieve this script?


title: How to verify one file of a package, not the RPM itself

text: For instance, can I somehow use `rpm` to verify that `/etc/pam.d/system-auth` is unchanged since it was installed on the system? I know I can do this with an entire RPM, but I want to know if I can do this on individual files or config files using the builtin `rpm` checksumming capabilities or something similar. Red Hat Linux 5/6.


title: How to rebuild glibc on Arch Linux?

text: It seems like MATLAB is royally screwed up on Linux, because it "dynamically loads some libs with static TLS", which doesn't mean anything to me other than I get bunches of errors. The suggested work around is to rebuild `glibc` with a larger `DTV_SURPLUS`. This leaves me with two questions:   * How do I rebuild `glibc` on Arch Linux to increase the `DTV_SURPLUS`? I looked at the PKGBUILD in the abs tree and didn't see `DTV_SURPLUS` anywhere, so I don't know where to make the change.   * What value do I set `DTV_SURPLUS` to be? Presumably, setting it to `2^64` would both be overkill and a bad idea. The issue with MATLAB can be seen with the following MWE in R2014a:               >> ones(10)*ones(10);     >> doc('help');     Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /opt/matlab/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: dlopen: cannot load any more object with static TLS         at java.lang.ClassLoader$NativeLibrary.load(Native Method)         at java.lang.ClassLoader.loadLibrary1(Unknown Source)         at java.lang.ClassLoader.loadLibrary0(Unknown Source)         at java.lang.ClassLoader.loadLibrary(Unknown Source)         at java.lang.Runtime.load0(Unknown Source)         at java.lang.System.load(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)     Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /opt/matlab/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: dlopen: cannot load any more object with static TLS         at java.lang.ClassLoader$NativeLibrary.load(Native Method)         at java.lang.ClassLoader.loadLibrary1(Unknown Source)         at java.lang.ClassLoader.loadLibrary0(Unknown Source)         at java.lang.ClassLoader.loadLibrary(Unknown Source)         at java.lang.Runtime.load0(Unknown Source)         at java.lang.System.load(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)     Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /opt/matlab/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: dlopen: cannot load any more object with static TLS         at java.lang.ClassLoader$NativeLibrary.load(Native Method)         at java.lang.ClassLoader.loadLibrary1(Unknown Source)         at java.lang.ClassLoader.loadLibrary0(Unknown Source)         at java.lang.ClassLoader.loadLibrary(Unknown Source)         at java.lang.Runtime.load0(Unknown Source)         at java.lang.System.load(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)     Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /opt/matlab/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: dlopen: cannot load any more object with static TLS         at java.lang.ClassLoader$NativeLibrary.load(Native Method)         at java.lang.ClassLoader.loadLibrary1(Unknown Source)         at java.lang.ClassLoader.loadLibrary0(Unknown Source)         at java.lang.ClassLoader.loadLibrary(Unknown Source)         at java.lang.Runtime.load0(Unknown Source)         at java.lang.System.load(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)     Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /opt/matlab/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: dlopen: cannot load any more object with static TLS         at java.lang.ClassLoader$NativeLibrary.load(Native Method)         at java.lang.ClassLoader.loadLibrary1(Unknown Source)         at java.lang.ClassLoader.loadLibrary0(Unknown Source)         at java.lang.ClassLoader.loadLibrary(Unknown Source)         at java.lang.Runtime.load0(Unknown Source)         at java.lang.System.load(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)         at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)      Where `ones(10)*ones(10);` loads the dynamically linked `libiomp5.so` BLAS library, which seems to not leave enough space for the dynamically linked `libxul.so` required for the HTML based documentation browser. Potentially I can work around this particular MWE by using a patched version of `libiomp5.so`, but the general problem still persists.


title: Adding a new interface on pfsense [ESXi 5.x]

text: I'm struggling to add a new interface on the pfsense as I already have a WAN & a LAN interface configured. Our server is enabled with two physical interfaces as both of them are connected to a centralized switches where WAN is on a managed switch and the LAN is on another switch distributed among internal users. Having said that, pfsense is a VM under ESXi & currently running pretty smooth with no issues. Now what I wanted is that to create another WAN created virtually and let it know to use the other router which has an internal IP. Below seen is the current model               xx.xxx.x.xxx -- internet            |            |     10.1.1.5/16 -- router            |             |     10.1.7.5/16 -- cisco switch            |            |     10.1.2.1/16 --ESXi            |     10.1.1.3/16 -- pfsense LAN (vm inside esxi)           ---- WAN (from managed switch) xx.xx.xx.xx             |     10.1.2.3/16 -- windows ad (vm inside esxi)                 10.1.10.5 - 10.255 / dhcp assigned by windows            |            |     10.1.10.200/16 -- client      I actually wanted to combine that router into the pfsense though its using an internal IP (given internal IP to access the router and distribute it among certain users to access that specific internet). Can we achieve this? Listed interfaces and I need to add the em3 to pfsense               Valid interfaces are:          em0   00:60:50:81:30:49   (up) Intel(R) PRO/1000 Legacy Network Connection 1.0.4     em1   00:65:52:81:30:4a   (up) Intel(R) PRO/1000 Legacy Network Connection 1.0.4     em2   00:0c:20:a6:a9:70 (down) Intel(R) PRO/1000 Legacy Network Connection 1.0.4     em3   00:30:56:81:0f:86 (down) Intel(R) PRO/1000 Legacy Network Connection 1.0.4     ovpns20   (up)