title: Object oriented Unix shell with at least LINQ capabilities?

text: Well, "at least" is rather -- it would be perfect ;-) There is similar question -- Object-oriented shell for *nix . For me similarity with bash is no issue. I would like to have some simple OOP plus LINQ. For now I am only aware of http://www.scsh.net/ but because of the syntax is a bit overkill. Maybe I will show you by example what I mean:               run("ls ./").foreach(it => println(it.filesize))      or               run("find -r *.jpg") \      .filter(it => it.datetime<today.adddays(-2)) \      .foreach(it => run("gimp ${it.filename}"))      **Is there anything closer to this "dream shell" than scsh?** _Why am I asking? Because the more programs I write, the more I am drifting towards functional languages (C++ -> C#+LINQ -> Scala -?-> Clojure), and when yesterday I had to write simple find+print loop in bash it was painful. A man gets easily spoiled with all functional stuff ;-D_.


title: Copying large tree from one machine to another, maintaining ownership

text: I am trying to copy a large folder structure between machines. I want to maintain the ownership/rights during the copy as it is not reasonable to 'fix' the privs afterwards. Therefore, I am using the following command to tar the file with privs intact and transfer the data to the destination machine. The same users exist on both machines.               tar cfzp - foldertocopy | ssh me@machine "cat > /applications/incoming/foldertocopy.tar.gz"      The transfer works fine, and the next step is to su to root on the remote machine and untar the file. The problem is: **there isn't enough disk space to store both the compressed and uncompressed data at the same time**. I could use rsync/recursive scp but my user doesn't have the rights to create the files with the correct privs itself and root can't log in remotely. What are my options? The source machine is RHEL4 and the destination is RHEL5.


title: "echo 1 > /sys/block/sdX/device/delete" on all disks except predetermined list

text: I have a list of scsi disks that I need to remove. The list is considered random at best and changes from time to time. I want to remove everything except a predefined list that I have created. Let's assume for now that I only want to keep:               /dev/sda     /dev/sdb      The command I need to execute is:               "echo 1 > /sys/block/sdX/device/delete"      Where X is the device to be removed. I'm not good at bash scripting so I don't really know where to start. To recap so I don't get DV'd for not being clear. I need to "echo 1 > /sys/block/sdX/device/delete" for every sdX device on the system except for a predetermined list. EDIT: After the answer below, this is what I've decided to use. "LocalDisks.txt" should contain lines like "/dev/sda"               #!/bin/bash     exclude=$(cut -d/ -f3 LocalDisks.txt)          for sysfile in /sys/block/sd* ; do          dev=$(basename $sysfile)     del=$sysfile/device/delete          if [[ $exclude == *$dev* ]] ; then         echo "Device $dev excluded"          elif [ ! -w $del ] ; then         echo "$del does not exist or is not writable"          else         echo 1 > $del     fi          done


title: Whats the best way to copy files from an ext3 file system to a NTFS and maintain the ownership and permissions?

text: I need to transfer over 1tb of data from a share on a ext3 file system that our corporate office uses. The share contains files with different owners and groups and needs to be copied over maintaining these permissions.


title: Text to movie from commandline

text: I need a script called `myslide` which does the following: `myslide -f 15 -t 20 "Hello World"` produces a movie file (to be played by mplayer), which just displays "Hello World" in the center of the screen in font size 15 for 20 seconds. Is there an easy way to do this?


title: Linux file system that ages off older files when partition is full

text: I am wondering if there is a file system equivalent to a round-robin database, which for a fixed size, ages off the oldest files. It is pretty easy to implement with a simple cron job, which I have, but I assume it is a problem many people have and there is perhaps something better. I wish to set a fixed- size partition, or pool, in which older files are automatically removed, or aged-off, when the pool is full. A type of circular-buffer that would use the space left by the oldest file for the new ones, whilst preserving file integrity. My cron solution compares disk usage to a threshold and recursively removes the oldest file until disk usage is again under the threshold. It is not perfect because one can't guarantee the threshold is low enough that it isn't overtaken between two cron iterations. It also doesn't maximize the use of the storage space because of the threshold value which tends to be predictive in nature (how much can I fill in one minute, between two iterations of crond). Two shortcomings I am hoping to improve upon. I am looking for a more elegant solution, akin to how the round-robin database (http://linux.die.net/man/1/rrdtool) handles this transparently, but for file systems.


title: how to run a script on ubuntu shutdown when it needs network on

text: I have an upstart script that needs to run on reboot or shutdown, but it needs to access the network to post an http requests and wait for the replies, I tried               start on starting rc      and               start on starting (rc and net-device-up IFACE=eth0)      but no luck.


title: Is Ubuntu 12.04 likely to be more stable compared to Debian testing?

text: **Update 1:** Stable as in, less likely to crash or cause any issues when future updates or security fixes are applied. **Original question:** I was about to post this question in askubuntu.com, but wanted to avoid bias views infavour of ubuntu, as I am sure most people like ubuntu over at askubuntu.com. My question is, if I wanted to do a minimal base command line installation of ubuntu 12.04 or debian testing (currently wheezy), which of these 2 is likely to be more stable over the next 5 years? 5 years because Ubuntu 12.04 will be supported for 5 years, and Debian testing is a rolling release afaik. I think ubuntu 12.04 will be more stable for various reasons even though it's based on debian testing, but just wanted to find out from more knowledgeable people, if ubuntu 12.04 really will be more stable compared to debian testing? So basically, I want to start off with a minimal command line install of ubuntu 12.04 or debian testing and add a minimal xfce to it using `-without- recommends`, and would like to know which of the 2 will be more stable as a desktop os, not as a server os.


title: Getting data under or above a line

text: This is my file:               print energy 1 end       Local net energy (PE 0) = 1.635393034217E+05 kJ/mol       Global net ELEC energy = 1.635393034217E+05 kJ/mol          print energy 2 end       Local net energy (PE 0) = 1.682997967326E+05 kJ/mol       Global net ELEC energy = 1.682997967326E+05 kJ/mol      I need the numbers, but the only way I know which one for me is the `print` line. So far, I have used this command to work it out:               tail -16 file.txt | head -1 | awk '{print $6}'      But this way is not good I believe. You have to rely on the line number. If the data is in the middle of thousand lines, you are lost. Do you know any better choice for this?


title: Flash Debugger on Slackware 64

text: Given a fresh install of Slackware64, how can I install the 32-bit Flash Plugin content debugger in Firefox and Chrome? Reading through this question, I've got pretty close, but I'm stuck with with the error: `nspluginwrapper: no appropriate viewer found`. Unfortunately, there's no SlackBuild for the Debug version of the flash plugin.


title: Using `tac` on zipped files

text: `tac unzipped.log | grep -m1 pattern` works perfectly fine but I am not able to use the `tac` command on zipped files. `tac zipped.gz | zgrep -m1 pattern` returns nothing. Is there anyway to use `tac` without unzipping my file ?


title: Installed Linux, now Windows doesn't boot anymore

text: I had a working Windows 8.1 which I used regularly.   Today I needed Linux, so I chose Ubuntu and installed it from a bootable flash drive alongside Windows. Everything worked well, I could choose which OS to boot: Windows or Ubuntu.   Due to some reasons (please don't ask me...) I decided to install another distribution and chose Mint. Apparently I didn't delete Ubuntu and just tried to install a third OS.   I don't know why, but at the and of the installation process I got a linux error so that the installation couldn't be finished. After the restart I couldn't start neither of my 3 OS. There was an error while booting.   So I installed Fedora (my current system). During the installation I had to partition my hard drive. It showed me my 3 OS, so I deleted the other 2 linux distribution and installed Fedora. The good thing: Fedora works!   The bad thing: When it boots, it doesn't show me my 2 OS (Windows and Fedora), it just boots Fedora.   I know that I haven't deleted Windows, I still can access my windows files through Fedora. There must be an error with the "boot manager", where I can choose which OS to boot. Is there any chance I can get my Windows back to work with all my files? Maybe just reinstalling it?


title: Merging multiple tab-delimited tables based on common columns

text: I am new to the field and I want to compare and merge 500 hundred tab- delimited files, each with two columns ("Position" and "Poly"). Examples of file1, and file2 (and other files) and the final output that I am looking for are as follows- File1:               Position Poly     100001  C     **228201  T**     341791  T     380441  C     **392640  T**     459055  A     459079  T     **480253  T**     570405  T     492633  A      File2:               Position        Poly     100001  C     **312002  C**     341791  T     380441  C     **412640  A**     459055  A     459079  T     **464056  T**     570405  T     492633  A      Output:               Position        File1 File2     100001  C       C     **228201  T       -**     **312002  -       C**     341791  T       T     380441  C       C     **392640  T       -**     **412640  -       A**     459055  A       A     459079  T       T     **480253  T       -**     **464056  -       T**     570405  T       T     492633  A       A      Basically, I want to convert them into a single matrix and put dash if a position is missing in any file.


title: How to capture error message from executed command?

text: I was tasked to create an automated server hardening script and one thing that they need is a report of all the output of each command executed. I want to store the error message inside a string and append it in a text file. Let's say I ran this command:               /sbin/modprobe -n -v hfsplus      The output of running this in my machine would be:               FATAL: Module hfsplus not found      How can I store that error message inside a string? Any help would be greatly appreciated. Thanks!


title: nm-applet openvpn connects only as root

text: I have a following problem, network-manager doesn't connect to vpn using openvpn, when I run it as a unpriviledged user. when I run sudo nm-applet and the choose to connect to vpn it works fine. similarily, when I run openvpn from command line it also has to be run with sudo to work. now I'm using Arch Linux, before I switched I was using ubuntu, and I could connect to vpn using nm-applet so it is possible :) I'd be grateful for any suggestions


title: How does the piping in this command ultimately achieve to kill the process?

text: I have seen the following line in a bash script for killing a process(in this case started with the command `loadgen`):               ps xww | grep -i "loadgen" | grep "PATTERNMATCH_FACT.xml" | cut -c1-5 | xargs -i kill {} 2>/dev/null      I would like to understand the reason for piping after the two grep's in the command above. The way the `loadgen` command is started is the following. It's a part of the startup script.               ./loadgen -XMLFile ${DEMODIR}/bam-103-pattern-match/data/PATTERNMATCH_FACT.xml -duration 0 -frequency 2


title: Why won't Linux let me play with /dev/dsp?

text: I'm working through a Linux textbook, and it's telling me about devices. It says that if I send the appropriate output to `/dev/dsp`, then it will play a sound. The example is `cat file.wav > /dev/dsp`, where file.wav is just any .wav file. When I do this I get permission denied. If I run this with sudo I still get permission denied. If I `su` first, no sound plays. Why do I get permission denied with `sudo`? Why does no sound play even with `su`?


title: How to install Mono v3+ in Ubuntu?

text: How can I install the latest release of Mono in Ubuntu Saucy? In order to develop in a free OS, I need to setup Mono (that now supports .NET 4.5). This is what I did:   1. Download and uncompress `mono-mono-3.2.5`   2. Run `./autogen.sh --prefix=/usr/local` (finished ok)   3. Run `make`, but it exit with error checking dependencies: terminal-output:               ....     mkdir -p -- build/deps     make[6]: gmcs: Command not found     make[6]: *** [build/deps/basic-profile-check.exe] Error 127     *** The compiler 'gmcs' doesn't appear to be usable.     *** You need Mono version 2.4 or better installed to build MCS     *** Check mono README for information on how to bootstrap a Mono installation.     make[5]: *** [do-profile-check] Error 1     make[4]: *** [profile-do--basic--all] Error 2     make[3]: *** [profiles-do--all] Error 2     make[2]: *** [all-local] Error 2     make[2]: Leaving directory `/home/hogar/Software/mono-mono-3.2.5/runtime'     make[1]: *** [all-recursive] Error 1     make[1]: Leaving directory `/home/hogar/Software/mono-mono-3.2.5'     make: *** [all] Error 2      But to install `mono-gmcs`, Ubuntu will also install `mono-runtime` _v2.10.8.1-5ubuntu2_. And that is exactly what I'm trying to not install, an old version of _mono_. This is confusing me, what should I do?


title: Find where is a shared library symbol defined on a live system / list all symbols exported on a system

text: Basically, this is two questions into one - because if I can list all symbols exported within a system, along with their shared library path, then I could simply `grep` that output. For kernel symbols, I guess it is somewhat easier - because we can always `cat /proc/kallsyms` and get a list of all symbols of those modules loaded in memory; then `sudo cat /proc/modules` will give a list of loaded modules with their addresses, but not the paths where does modules have been loaded from (if they are built as separate, out-of-tree .ko objects) For instance, I try to trace the program `kst` using `ltrace`:               $ ltrace kst2     ...     _ZNK13QGraphicsItem10parentItemEv(0xa1ccdb4, 0, 0xbfe631a8, 0x823652b, 0xbfe63298) = 0xa1ce854     __dynamic_cast(0xa1ce854, 0x839ff00, 0x8306b80, 84, 0xbfe63298)     = 0xa1ce800     _ZNK13QGraphicsItem10parentItemEv(0xa1ccdb4, 0x839ff00, 0x8306b80, 84, 0xbfe63298) = 0xa1ce854     __dynamic_cast(0xa1ce854, 0x839ff00, 0x8306b80, 84, 0xbfe63298)     = 0xa1ce800     ...      ... and I would like to know where this `_ZNK13QGraphicsItem10parentItemEv` resides. So, what to do about shared library symbols? Reading through [gcc-help] Re: finding the library in which symbol is defined.; I tried something like this:               $ find /usr/lib -name '*.so*' -exec nm --print-file-name --defined-only --dynamic {} \; | grep "QGraphicsItem"     ...     /usr/lib/libQtGui.so.4.7.2:00766d70 T _Zls6QDebugN13QGraphicsItem16GraphicsItemFlagE     /usr/lib/libQtGui.so.4.7.2:00766aa0 T _Zls6QDebugN13QGraphicsItem18GraphicsItemChangeE     /usr/lib/libQtGui.so.4.7.2:00767e80 T _Zls6QDebugP13QGraphicsItem     ...      ... but that gives me additional problems: I don't really know all the paths which are scanned for shared libraries on my system, so when I first tried `find /lib ...` it didn't find anything; I find this guessing of directories irksome, just as well as the alternative: scanning the entire root filesystem with `find` ... And also, I seem to hit up *.so's which cannot be opened by `nm` (maybe because they are symlinks?), which output a quite a bit of error messages (which I don't like either). The thing is - `ldd` (or `ld`?) probably performs some of this lookup of symbols, but I tried the respective manpages, and I cannot see a way to "find" any symbol from the command line, without providing some sort of executable file as an argument. Side question - would there a way to use these tools for that? So, what I'm looking for a command line tool, which would behave something like (pseudocode):               $ ./findsymbol '_Zls6QDebugN13QGraphicsItem16GraphicsItemFlagE'     symbol found in:         /usr/lib/libQtGui.so.4.7.2:00766d70 T _Zls6QDebugN13QGraphicsItem16GraphicsItemFlagE     ...      ... where I don't specify any directories to search - but which would also handle, e.g. `LD_PRELOAD` or `LD_LIBRARY_PATH`; say if I do:               $ LD_PRELOAD="/path/to/mylib.so" ./findsymbol '*mylib_print*'      ... then I'd get the `/path/to/mylib.so` where the given symbol was defined (given that such a symbol wouldn't exist in the standard libraries) - and would output "not found" otherwise. And otherwise, `./findsymbol --dumpall` could produce a list of all available symbols and their locations seen from a given environment (e.g. a specific `bash` shell). Does a tool like this exist for Linux?


title: NFS mount fails at boot time

text: I have the following in `/etc/fstab` on FreeBSD:               venture:/usr/redacted    /usr/local/redacted   nfs     rw      0       0      This fails during boot. However, after boot, the following command succeeds               mount -t nfs venture:/usr/redacted /usr/local/redacted      Two related questions: 1) last time I rebooted at the console (this machine is in a datacenter), I'm pretty sure I saw an explanatory message at boot time regarding the failure to mount. I think it had something to do with resolving the hostname. However, this message does not appear in `/var/log/messages` with other boot-time messages; is there someplace else I should be looking? 2) Any thoughts about what could be preventing the hostname from resolving at boot time, but no problem 30 seconds later from the command prompt?


title: How do I get a single total of lines with `wc -l`?

text: I've added a git alias to give me the line counts of specific files in my history:               [alias]     lines = !lc() { git ls-files -z ${1} | xargs -0 wc -l; }; lc      However, `wc -l` is reporting multiple totals, such that if I have more than ~100k lines, it reports the total for them, then moves on. Here's an example: ### <100k lines (desired output)               $ git lines \*.xslt       46 packages/NUnit-2.5.10.11092/doc/files/Summary.xslt      232 packages/NUnit-2.5.10.11092/samples/csharp/_UpgradeReport_Files/UpgradeReport.xslt      278 total      ### >100k lines (had to pipe to `grep "total"`)               $ git lines \*.cs | grep "total"      123569 total      107700 total      134796 total      111411 total       44600 total      How do I get a true total from `wc -l`, not a series of subtotals?


title: OpenSSH: How to end a match block

text: I'm using a `Match` block in OpenSSH's `/etc/ssh/sshd_config` (on debian) to restrict some users to SFTP:               # my stuff     Match group sftponly         X11Forwarding no         AllowTcpForwarding no         ForceCommand internal-sftp -u 0002         ChrootDirectory %h      As you can see, I use a `#my stuff` comment in custom config files to easily distinguish default configurations from those I made (and I put those at the end of the config files).   Now I wanted to append the directive `UseDNS no` to the configuration (to speed up logins) but OpenSSH said `Directive 'UseDNS' is not allowed within a Match block`. Now I was wondering whether there is a syntax like `End Match` to end those match blocks?


title: One PC, several users, Gnome 3 and Awesome. How to easy switch users via GDM

text: I'm using Arch Linux with Gnome 3.6 installed. There are several users on this PC with their own accounts. We used to use just `switch user` button instead of logging out. So almost always several users are logged in in our PC with their own set of running apps and etc. I want to switch to Awesome and I want to save this. I want to be able to switch from my Awesome session to other user Gnome session without logout from my session. I want to use gnome-screen saver as screen saver in my Awesome WM session. And that's all. It is only 2 things that I want to save from Gnome. Is it possible? What is the best practice for setting such things up?


title: Setting permissions with FTP

text: I'm having some issues setting up permissions for FTP. Read another thread on here regarding it, but I wasn't sure if it really matched what I needed. Essentially, right now I've got the client's FTP and home directories set up correctly, but once they upload a file, they find that the file cannot be edited, I think this is due to the previous permissions of the file. So my question is, how do I allow them to edit all of the files within their home directory, regardless of the permissions, without compromising the root of the machine. Please note, that the FTP access is to a virtual machine that they own, but I want to create seperate accounts for seperate directories, regarding FTP access.


OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to 178.xxx.xxx.xxx [178.xxx.xxx.xxx] port 22.     debug1: Connection established.     debug1: identity file /home/orangetux/.ssh/id_rsa type 1     debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048     debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048     debug1: identity file /home/orangetux/.ssh/id_rsa-cert type -1     debug1: identity file /home/orangetux/.ssh/id_dsa type -1     debug1: identity file /home/orangetux/.ssh/id_dsa-cert type -1     debug1: identity file /home/orangetux/.ssh/id_ecdsa type -1     debug1: identity file /home/orangetux/.ssh/id_ecdsa-cert type -1     ssh_exchange_identification: Connection closed by remote host      Via an admin panel I can access the logs and I see:               Mar  8 20:32:10 vmi11458 sshd[2334]: Set /proc/self/oom_adj to 0     Mar  8 20:32:10 vmi11458 sshd[2334]: refused connect from 82.xxx.xxx.xxx (82.xxx.xxx.xxx)      I've stopped the DenyHosts service. But I still cannot log in. How can I solve this?


title: Compression Level Mksquashfs

text: Here I'm trying to create a squashfs filesystem but the resulting image is bigger than the original version and not because I added a file or anything as I only modified some configuration files. What I'm trying to do is modify the existing squashfs filesystem on a live usb and delete some info to start the OS in a login shell. Since I fixed an amount of space to the EXT4 partition I need the modified squashf to have the same size as the original. I can do the changes while the live system is running but since I'm making a script to automate this process I need to do it before creating the live usb itself. The problem comes when recreating the image as the resulting file is about 400mb larger than the original and when I use the -b 4096/1Mbyte option the image is about 800mb larger when the original file is about 2.2gb. I did the same before to add my script to the filesystem and it worked great but now I can't understand what happen this time. I searched my backup of .bash_history but with no luck How can I reduce the image size?? What I'm doing wrong, anyone?? Edit:               # Create Directories     mkdir /mnt/kali-iso     mkdir /mnt/squash     mkdir /tmp/squash_mod          # Mount ISO And Squashfs Image     mount /root/kali.iso /mnt/kali-iso     mount /mnt/kali-iso/live/filesystem.squashfs /mnt/squash -o loop          # Copy All Files To A Temp Directory To Modify Them     cp -rf /mnt/squash/* /tmp/squash_mod     cp /root/foo.sh /tmp/squash_mod/root/Desktop/          # Create Squashfs     mksquashfs /tmp/squash_mod filesystem.squashfs       Or               # mksquashfs /tmp/squash_mod filesystem.squashfs -b 4096 # or 1Mbyte      Results from "du" command:               du -ch /mnt/squash | grep "total"  =  6.6G total          du -ch /tmp/squash_mod | grep "total"  =  7.2G total      There are some discrepancies between the same folders, their size are different: "/tmp/squash_mod/sbin = 8.8mb" "/mnt/squash/sbin = 8.5mb" "/tmp/squash_mod/var = 309mb" "/mnt/squash/var = 282mb" "/tmp/squash_mod/bin = 7.0mb" "/mnt/squash/bin = 6.8mb"


title: Commands to read and eject CD?

text: My laptop is a Thinkpad T400 and the OS is Ubuntu 12.04. I find I have a problem where the CD-RW on my laptop sometimes doesn't read the CD, following some flashing light and sound, after I inserted the CD inside. I press the button to eject the CD, but there is no response. It happens especially when I have some external device using a USB port of the laptop. But sometimes it works as normal. I wonder if there are some Linux commands to force the CD to be read and to be ejected? What might be the problem? The OS, or the CD Reader?


title: yahoo messenger for linux

text: I want to install the latest version of yahoo messenger in RHEL5 & FEDORA. Is that possible? Where to get it and how do I install it?


title: Primary vs Logical partition

text: I know that you can only have 4 primary partitions on a hard drive. But if you're using less than 4, is there a benefit/penalty for using logical partitions?


title: How to match name exactly with Bash's `help` builtin?

text: It seems the Bash built-in help command `help` does some really strange globbing:   * `help read` shows the documentation for `read`, `readarray` and `readonly`.   * `help rea?` shows only the documentation for `read`.   * `help 'read$'` doesn't work.   * `help read | sed '/^read[^:]\\+/,$d'` is just silly. Is there some more intuitive way to get only the `read` output?


title: Replace USB stick boot device with SSD

text: I have an OpenElec based HTPC which boots from a USB stick. I would like to replace this with an SSD drive. What is the best way of copying the USB image to the SSD. Is this something that dd could do or would I be better off reinstalling on the SSD from scratch?


title: Applying different permissions to files vs. directories

text: Sunny answered the question above in this post, The answer was given as > No need for scripts. > > // Directories: >   >   >     find . -type d -exec chmod XXX {} \; >   > > // Files: >   >   >     find . -type f -exec chmod XXX {} \; >   Can you please explain this in layman language? I really dislike unexplained `{}` and `\` markup and don't care much for the `;` either! I've been trying to learn Linux cli / bash / shell whatever and googling etc., to find answers and on the most part it's working well, except when the above happens.


title: Unable to get embedded device to ping anything on the network

text: I have an embedded device, built using buildroot, kernel version 3.6.11 running busybox. The kernel is built with completely default options. I have configured the device according to what the network guy has specified for the IP, gateway, netmask etc and I have put these values in the /etc/network/interfaces file. When the system boots up, a call to `ifconfig` tells me that all the network settings are what they are supposed to be. However, I cannot ping any other machine on the same subnet as the device. I can communicate with my host machine with a direct ethernet cable connection so I think the network adapter is ok - I can `ssh` to the host, and the host can view the target correctly from the `vsftpd` I have installed on the device. Basically I am very unsure how to proceed with diagnosing the problem. I am drowning on internet forum linux network setup guides and getting nowhere. Also, worryingly, when I type               # ip addr show dev eth0      I get the report of a segfault in libuClibc-0.9.33.2.so. I built this all using buildroot and it reported that everything was successful. Is it possible that I have a broken kernel?? I really do not know how to proceed so any advice would be gratefully received. **EDIT** The output from `ip addr show dev eth0` is               2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen         1000 link/ether 00:18:7d:19:a0:d8 brd ff:ff:ff:ff:ff:ff         inet 172.18.255.212/24 brd 172.18.255.255 scope global eth0     [  331.700545] ip[951]: segfault at 0 ip b76e1f26 sp bfbd29b0 error 4 in      libuClibc-0.9.33.2.so[b76b5000+4d000]     Segmentation fault      When I call the same command on the other adapter eth1, then I get no segfault, so really don't know what is going on. **EDIT2** After rebuilding with debug information and `strace` I was able to get strace output of the segfault - I do not really know what this means though other than it looks like it is trying to write to a location it perhaps should not (I have not included it all, just the last few lines).               socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4     ioctl(4, SIOCGIFTXQLEN, {ifr_name="eth1", ifr_qlen=1000}) = 0     close(4)                                = 0     write(1, "3: eth1: <BROADCAST,MULTICAST,UP"..., 793: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000     ) = 79     write(1, "    link/ether 00:18:7d:19:a0:d7"..., 55    link/ether 00:18:7d:19:a0:d7 brd ff:ff:ff:ff:ff:ff     ) = 55     open("/etc/iproute2/rt_scopes", O_RDONLY) = 4     ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbfc91b30) = -1 ENOTTY (Inappropriate ioctl for device)     read(4, "#\n# reserved values\n#\n0\tglobal\n2"..., 4096) = 92     read(4, "", 4096)                       = 0     close(4)                                = 0     write(1, "    inet 192.168.12.198/16 brd 1"..., 65    inet 192.168.12.198/16 brd 192.168.255.255 scope global eth1     ) = 65     --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---     +++ killed by SIGSEGV +++     Segmentation fault


title: Play last few seconds of mp3

text: Is there any way to play last N seconds of an `mp3` file on `bash` commandline?


title: Compare two kernel config files from the menuconfig perspective?

text: I have a situation in which i have two kernel config files (for the same kernel source ). Both of them have a part of the functionality that i need (on one, USB works correctly, on other, the second I2C). I know that the differences between the two config files, from the perspective of menuconfig, include only a few selected options. (But don't know which ones) However when the config files are manually compared (meld between two .config files), the differences are not simple to identify. I have tried merging them manually without success. I'm sure I'll succeeded eventually but believe the process could be much more painless if the files were compared in a way they appear in the menuconfig. Can this be achieved, and if so, how?


title: VPN, one server, multiple clients

text: I wanted to know if it was possible to have a server running OpenVPN with server key and have multiple clients connect to it? I would like the server to be 10.9.8.1, the first client to be 10.9.8.2 (this works) and have a third one be 10.9.8.3 so the three of them appear on the same private network. I couldn't manage to connect the third one, I get               TCP/UDP: Socket bind failed on local address [undef]:1194: Address already in use.      when I try to connect the third one to the VPN server.


title: There is no bash indicator prompt after a forked process terminates

text: I am reading the book _Advanced Programming in the Unix Environment_. There is a test program to test the `fork` function. It works well in my Ubuntu. But what I confused is that why there is no command indicator prompt after the child process exits. The original program is like the below.               #include <stdio.h>     #include <unistd.h>     #include <sys/wait.h>          int main()     {       pid_t pid;       if ((pid = fork()) < 0)       {         printf("fork error.\n");         return 1;       }       else if (pid == 0)       {         if ((pid = fork()) < 0)         {           printf("fork error.\n");           return 1;         }         else if (pid > 0)         {           printf("first child %d exit.\n", getpid());           exit(0);         }         sleep(2);         printf("second child %d has parent pid = %d.\n",getpid(),  getppid());         exit(0);       }            printf("waitid %d.\n", pid);       if (waitpid(pid, NULL, 0) != pid)       {         printf("waitid error.\n");         return 1;       }       printf("process %d will exit..\n", getpid());            exit(0);     }      Then I run               jerryli@ubuntu:~/project/unix$ ./p183.o     waitid 2256     first child 2256 exit.     process 2255 will exit..     jerryli@ubuntu:~/project/unix$ second child 2257 has parent pid = 1.      After above line prompt, there is nothing continue. I expect it would show               jerryli@ubuntu:~/project/unix$      In order to have above indicator, I have to type `Enter`. Could you know the reason? Is that because the second child's parent process becomes the system init process?


title: Looking for /procfs documentation, describing values and units of measurement

text: Surprisingly, comprehensive documentation for `/procfs` is hard to find. For my specific question, I am looking at: `cat /proc/1/statm` (let's use `pid=1` because it seems to be always there). I just ran this and got a result:               9370 954 341 210 0 727 0        1. Which one of these is resident memory?   2. What is it measured in?   3. How can I convert it to Megabytes?


title: how does linux update page table after context switch

text: How does Linux's Virtual Memory system handle the following case:   1. Process 1 maps one of its virtual page to physical frame 1.    2. Context switches to process 2.   3. Process 2 swaps out frame 1 and replace with its own content.   4. Context switches back to process 1. How does process 1 knows that it does not own the content of frame 1 and needs to do a swap in?


title: How to use bash control a keyboard

text: How to use bash command control a Keyboard. e.g. what is a command in bash for pressing ctrl+c, ctrl+l, etc..?


title: Generate multiple symbolic links with maitaining directory structure

text: I want to generate symbolic links from multiple folders with maintaining the directory structure. I read a few answers and the best thing i can come up with now is:               find /data/DIV5/SASC/e042_ctcl/input/*/Clean_data/*/*/*.fq.gz -type f -exec ln -sf \{\} . \;      This generates symlinks all in the same directory. But what i want is to have the same directory structure as in the find command and if possible only the same structure as from input on. So for example: `input/*/Clean_data/*/*/*.fq.gz` So when files and directories are matched the symlink should follow the same structure as the absolute link found with the find command. Any input is appreciated.


title: How check which user plug in device

text: I have some rules for example:               KERNEL=="sdb[1-9]", RUN+="some_script.sh"      In some_script.sh how can I determine which user is plug in device.


title: For loops in zsh and bash

text: I have noticed there are two alternative ways of building loops in **zsh** :   1. `for x (1 2 3); do echo $x; done`   2. `for x in 1 2 3; do echo $x; done` They both print:               1     2     3      My question is, why the two syntaxes? Is `$x` iterating through a different **type of object** in each of them? Does **bash** make a similar distinction? ## Addendum: Why does the following work?:               #!/bin/zsh     a=1     b=2     c=5              d=(a b c)         for x in $d; do print $x;done      but this one doesn't?:               #!/bin/zsh     a=1     b=2     c=5          d=(a b c)         # It complains with "parse error near `$d'"     for x $d; do print $x;done


title: Switching runlevel when moving /var to another partition

text: I'm running Ubuntu 10.04 and I would like to move /var to another partition using a python script. I found some directions that I thought were pretty good, but they call for switching to runlevel 1 (single-user mode) to prevent changes to /var while it is moved. Is switching the runlevel necessary? Do I just call `os.system('init 1')` directly in my script? Can I put the system back in its normal state just by calling `os.system('init 2')` after the script is done? When I'm connected over SSH I get booted out when I run `init 1` myself, even if I'm connected as root. If I'm at the keyboard when I do `init 1` I get the message: `Will now switch to single-user mode, Give root password for maintenance (or type Control-D to continue):`. My root password does not work at that point so I've tried `Control-D` and logging in as a user. `runlevel` then says the system is back at runlevel 2, but I can't reconnect by SSH until I reboot the system. Any help understanding what is going on is appreciated!


title: Raspberry PI crosscompile with cmake

text: Using this short tutorial Installing Raspberry pi Cross Compiler, I have successfully compiled the "cmake-hello-world" example. I tried to compile one of my other little apps which contains about 12 source files (plain `c` and `h`), using `liboop` and `ecpg`. I have created CMakeLists.txt:               CMAKE_MINIMUM_REQUIRED(VERION 2.8 FATAL_ERROR)     PROJECT(usms C)     ADDEXECUTABLE(usms usms-main.c usms-ecpg.c ...)      Step into build directory and invoke cmake               cmake -D CMAKE_TOOLCHAIN_FILE=$HOME/rpi/tools/rpi.cmake ../     make      Make started to compile with `usms-main.c` (which is a little unusual for me) and ending with an error that it could not find `oop.h` included (the main include file for `liboop`). I'm trying to understand why it is happening, but have no clue. I have checked `Makefiles`, but it does not contain anything about `rootfs` which contains `oop.h` `roptfs/usr/include` and copied from Raspberry pi itself. What am I missing? Any suggestions? I'm using Debian Squeeze (oldstable) i386, Cmake version 2.8.2 which was included in distribution. The application is compiling without errors on the same box using i386 architecture and `Makefile` (hand made).


title: Launch a fake/minimal X session for Pulseaudio/dbus

text: I use Pulseaudio to share audio between a desktop and a Raspberry Pi. However, Pulseaudio needs dbus, and dbus needs an X session. Without graphical session, Pulseaudio is only able to run in system mode, which is officially not recommanded. Besides on a Raspberry Pi, the cost of an X session is dramatically high, so I would like to get rid of it in the most efficient (less costly) way. How can I start the smallest X session for Pulseaudio to kick in ?


title: Cross compiling libSDL

text: I'm trying to cross-compile libSDL version 1.2 for a custom made, Debian based Linux system. The toolchain I'm using is already configured properly so that I just run `gcc`/`g++` on the desired code and the resulting output is compatible with the target machine. When I run `./configure --help` in the libSDL source directory, I see that I can basically just set some environment variables to point to my cross- compiler. However, I also see the following options:               System types:       --build=BUILD     configure for building on BUILD [guessed]       --host=HOST       cross-compile to build programs to run on HOST [BUILD]      I looked into the `configure.in`, `build-scripts/config.sub`, and `build- scripts/config.guess` files but couldn't really figure out how it works. Are these options required? If not, is it a good idea to use them?


title: Download anything

text: Is there any app you're aware of (CLI, GUI, or even a library in some language) that will simply download almost any file on any protocol I throw at it? Seems like something that should exist, right? Of course such an app would have to gracefully handle a very large number of error conditions and protocols. For simply "acquiring" some content, all the millions of permutations of technical details just_don't_matter.


title: Setting up a 3 monitor display?

text: I currently have a Radeon HD 5750 graphics card and an M3N78-PRO motherboard. I use both outputs of my graphics card for a 2 screen display. I use `xrandr` at boot to set up my two screens. However, I was wondering if (1) would it be possible to attach a third monitor to the HDMI output on my motherboard and (2) if it is, how I can use `xrandr` to set up the third monitor correctly. Hardware-wise, I don't know if this is possible (I sure hope so). If it is possible, will there be any confusion at the OS level as to where to send the display (motherboard vs. graphics card)?


title: bash script works with in debug only

text: I'm trying to remove characters from a file name. ### files               #ls     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFlac).flac     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFlac).log     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.cue      What I want for output:               #ls     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.cue     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log      ### script               #!/bin/bash     SUFFIX="(AutoFLAC)"     #search directory for file with a suffix of (AutoFLAC)     for entry in *$SUFFIX*     do        #remove a leading space and (AutoFLAC) from the file name        FILENAME=`echo $entry | sed 's/ (AutoFLAC)//'`        echo "$entry"        echo "$FILENAME"        #change the old file name for the new file name        mv  "$entry" "$FILENAME"      done      If I add `-x`, it works.               Mac-Attack:edit-file-names $ ./edit-file-names1.sh      + SUFFIX='(AutoFLAC)'     + for entry in '*$SUFFIX*'     ++ echo Peter, Paul '&' Mary - The Very Best of Peter, Paul and Mary '(AutoFLAC).flac'     ++ sed 's/ (AutoFLAC)//'     + FILENAME='Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac'     + echo 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).flac'     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).flac     + echo 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac'     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac     + mv 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).flac'      'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac'     + for entry in '*$SUFFIX*'     ++ echo Peter, Paul '&' Mary - The Very Best of Peter, Paul and Mary '(AutoFLAC).log'     ++ sed 's/ (AutoFLAC)//'     + FILENAME='Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log'     + echo 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).log'     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).log     + echo 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log'     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log     + mv 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary (AutoFLAC).log' 'Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log'     Mac-Attack:edit-file-names $ ls     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.cue     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.flac     Peter, Paul & Mary - The Very Best of Peter, Paul and Mary.log      Without the `-x`:               Mac-Attack:edit-file-names $ ./edit-file-names2.sh      *(AutoFLAC)*     *(AutoFLAC)*     mv: rename *(AutoFLAC)* to *(AutoFLAC)*: No such file or directory      Insights, thoughts?


title: Audiowerk 8 drivers for Linux

text: Does a driver exist for the old Audiowerk 8 sound card from now defunct Emagic? I have a system running Ubuntu 13.10 and would like to utilize one of these old sound cards.


title: How to enable NFS4 protocol

text: I have found nothing that could help me with enabling NSF4 protocol               rpcinfo -u localhost nfs     program 100003 version 2 ready and waiting     program 100003 version 3 ready and waiting      How can I add version 4? I am on a Debian flavor. (I have more PC's with Debian/Ubuntu Linux and NFS4 installed already. But NFS4 protocol was available out of the box. I checked `/etc/hosts.allow/deny`, `/etc/defaults/nfs-kernel-server` + `nfs-common` are setup correctly - `/etc/init.d/nfs-kernel-server` is identical with the one on other working PC - what can I do?)


title: Linux user's guide to windows?

text: I am a grad student who recently found out that I will have to switch to a Windows box for my research (despite my pleading). I know there are lots of guides out there for Windows users switching to Linux but I haven't found too many for the reverse. Does anyone have some good resources? I am used to doing everything in a bash shell. I like doing my text edits with vim and I like setting up shell scripts. I would like to make the transition as painless as possible.


title: Share memory between a virtual machine and the host

text: Through `shmget` and `shmat`, I am able to access the data stored in one program from another program. Here's the gist of the code:               key=ftok("shared.c",'c');     shmid=shmget(key,1024,0644|IPC_CREAT);     data=shmat(shmid,(void *)0,0);     printf("Enter the data");     gets(data);      Similarly I can write another program and use `shmat` there to access the data. Now I wanted to know how can I access it from the host operating system. Since the shared memory id will be different in the host memory, `shmat` won't work. How can I access the shared memory from the host machine? can we do it in this way: we know that there exist a page table with respect to each operating system in a hypervisor which will maps the logical address to physical address,there is a pmap table which maps the physical address of the hypervisor with the physical address of the host machine,and also there exist shadow page tables in hypervisor which maps the logical guest address to host physical address. Is there any way of accessing the shadow page tables or pagetable corresponding to the OS


title: Installing OpenSSL shared libraries on CentOS 6.5

text: OS: CentOS-6.5-x86_64-minimal      I downloaded the latest version of OpenSSL Extracted it with `tar -xvzf openssl-1.0.1e.tar.gz`               cd openssl-1.0.1e     ./config --prefix=/usr/local     make      it gives me the following error:               making all in crypto...     make[1]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto'     making all in crypto/objects...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/objects'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/objects'     making all in crypto/md4...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/md4'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/md4'     making all in crypto/md5...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/md5'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/md5'     making all in crypto/sha...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/sha'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/sha'     making all in crypto/mdc2...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/mdc2'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/mdc2'     making all in crypto/hmac...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/hmac'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/hmac'     making all in crypto/ripemd...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ripemd'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ripemd'     making all in crypto/whrlpool...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/whrlpool'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/whrlpool'     making all in crypto/des...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/des'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/des'     making all in crypto/aes...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/aes'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/aes'     making all in crypto/rc2...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/rc2'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/rc2'     making all in crypto/rc4...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/rc4'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/rc4'     making all in crypto/idea...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/idea'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/idea'     making all in crypto/bf...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/bf'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/bf'     making all in crypto/cast...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/cast'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/cast'     making all in crypto/camellia...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/camellia'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/camellia'     making all in crypto/seed...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/seed'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/seed'     making all in crypto/modes...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/modes'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/modes'     making all in crypto/bn...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/bn'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/bn'     making all in crypto/ec...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ec'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ec'     making all in crypto/rsa...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/rsa'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/rsa'     making all in crypto/dsa...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/dsa'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/dsa'     making all in crypto/ecdsa...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ecdsa'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ecdsa'     making all in crypto/dh...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/dh'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/dh'     making all in crypto/ecdh...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ecdh'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ecdh'     making all in crypto/dso...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/dso'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/dso'     making all in crypto/engine...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/engine'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/engine'     making all in crypto/buffer...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/buffer'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/buffer'     making all in crypto/bio...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/bio'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/bio'     making all in crypto/stack...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/stack'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/stack'     making all in crypto/lhash...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/lhash'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/lhash'     making all in crypto/rand...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/rand'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/rand'     making all in crypto/err...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/err'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/err'     making all in crypto/evp...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/evp'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/evp'     making all in crypto/asn1...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/asn1'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/asn1'     making all in crypto/pem...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/pem'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/pem'     making all in crypto/x509...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/x509'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/x509'     making all in crypto/x509v3...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/x509v3'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/x509v3'     making all in crypto/conf...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/conf'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/conf'     making all in crypto/txt_db...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/txt_db'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/txt_db'     making all in crypto/pkcs7...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/pkcs7'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/pkcs7'     making all in crypto/pkcs12...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/pkcs12'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/pkcs12'     making all in crypto/comp...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/comp'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/comp'     making all in crypto/ocsp...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ocsp'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ocsp'     making all in crypto/ui...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ui'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ui'     making all in crypto/krb5...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/krb5'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/krb5'     making all in crypto/cms...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/cms'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/cms'     making all in crypto/pqueue...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/pqueue'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/pqueue'     making all in crypto/ts...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/ts'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/ts'     making all in crypto/srp...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/srp'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/srp'     making all in crypto/cmac...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/crypto/cmac'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto/cmac'     if [ -n "" ]; then \                     (cd ..; make libcrypto.so.1.0.0); \             fi     make[1]: Leaving directory `/usr/local/src/openssl-1.0.1e/crypto'     making all in ssl...     make[1]: Entering directory `/usr/local/src/openssl-1.0.1e/ssl'     if [ -n "" ]; then \                     (cd ..; make libssl.so.1.0.0); \             fi     make[1]: Leaving directory `/usr/local/src/openssl-1.0.1e/ssl'     making all in engines...     make[1]: Entering directory `/usr/local/src/openssl-1.0.1e/engines'     echo          making all in engines/ccgost...     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/engines/ccgost'     make[2]: Nothing to be done for `all'.     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/engines/ccgost'     make[1]: Leaving directory `/usr/local/src/openssl-1.0.1e/engines'     making all in apps...     make[1]: Entering directory `/usr/local/src/openssl-1.0.1e/apps'     rm -f openssl     shlib_target=; if [ -n "" ]; then \                     shlib_target="linux-shared"; \             elif [ -n "" ]; then \               FIPSLD_CC="gcc"; CC=/usr/local/ssl/fips-2.0/bin/fipsld; export CC FIPSLD_CC; \             fi; \             LIBRARIES="-L.. -lssl  -L.. -lcrypto" ; \             make -f ../Makefile.shared -e \                     APPNAME=openssl OBJECTS="openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o" \                     LIBDEPS=" $LIBRARIES -ldl" \                     link_app.${shlib_target}     make[2]: Entering directory `/usr/local/src/openssl-1.0.1e/apps'     ( :; LIBDEPS="${LIBDEPS:--L.. -lssl  -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )     ../libcrypto.a(x86_64cpuid.o): In function `OPENSSL_cleanse':     (.text+0x1a0): multiple definition of `OPENSSL_cleanse'     ../libcrypto.a(mem_clr.o):mem_clr.c:(.text+0x0): first defined here     ../libcrypto.a(cmll-x86_64.o): In function `Camellia_cbc_encrypt':     (.text+0x1f00): multiple definition of `Camellia_cbc_encrypt'     ../libcrypto.a(cmll_cbc.o):cmll_cbc.c:(.text+0x0): first defined here     ../libcrypto.a(aes-x86_64.o): In function `AES_encrypt':     (.text+0x460): multiple definition of `AES_encrypt'     ../libcrypto.a(aes_core.o):aes_core.c:(.text+0x5cf): first defined here     ../libcrypto.a(aes-x86_64.o): In function `AES_decrypt':     (.text+0x9f0): multiple definition of `AES_decrypt'     ../libcrypto.a(aes_core.o):aes_core.c:(.text+0xa4b): first defined here     ../libcrypto.a(aes-x86_64.o): In function `private_AES_set_encrypt_key':     (.text+0xab0): multiple definition of `private_AES_set_encrypt_key'     ../libcrypto.a(aes_core.o):aes_core.c:(.text+0x0): first defined here     ../libcrypto.a(aes-x86_64.o): In function `private_AES_set_decrypt_key':     (.text+0xd80): multiple definition of `private_AES_set_decrypt_key'     ../libcrypto.a(aes_core.o):aes_core.c:(.text+0x3e5): first defined here     ../libcrypto.a(aes-x86_64.o): In function `AES_cbc_encrypt':     (.text+0xfa0): multiple definition of `AES_cbc_encrypt'     ../libcrypto.a(aes_cbc.o):aes_cbc.c:(.text+0x0): first defined here     collect2: ld returned 1 exit status     make[2]: *** [link_app.] Error 1     make[2]: Leaving directory `/usr/local/src/openssl-1.0.1e/apps'     make[1]: *** [openssl] Error 2     make[1]: Leaving directory `/usr/local/src/openssl-1.0.1e/apps'     make: *** [build_apps] Error 1      I tried `yum -y install openssl`. I want to install OpenSSL to be able to use the HTTPS protocol in CURL, and different applications. `openssl` (which is the binary) is installed, but OpenSSL (which is required for the HTTPS protocol is not installed). Any solutions to this problem?


title: tar + rsync + untar. Any speed benefit over just rsync?

text: I often find myself sending folders with 10K - 100K of files to a remote machine (within the same network on-campus). I was just wondering if there are reasons to believe that,                tar + rsync + untar      Or simply                tar (from src to dest) + untar      could be faster in practice than               rsync       when transferring the files **for the first time**. I am interested in an answer that addresses the above in two scenarios: using compression and not using it. # Update I have just run some experiments moving 10,000 small files (total size = 50 MB), and `tar+rsync+untar` was consistently faster than running `rsync` directly (both without compression).


title: How to start an application as GNOME would by command line?

text: How would I start an application (by launcher) the exact same way as GNOME would, in a command line interface? I want to set some environment variables. I know I can check the launcher file for the 'EXEC' command but for some reason that command makes my application crash; while when it's launched through GNOME it works fine.


title: How to use private-key to setup password-less ssh on new machine

text: I have one machine say "source1" and there is passwordless ssh already set to more than 100 server say remote1,remote2 ...remote100. Now I need to set similar setup of passwordless ssh on another server "source2" and I dont want to copy the public key of source2 to authorized_keys file of all hundred server. Can I use the private key of server source1 to set similar setup on source2 ?How to achieve that ? I heard of ssh-agent is one of the way but couldnot understand much on the steps.


title: How to resume a gnome session?

text: I am in the middle of a project where I repeatedly have to stop X11 to debug. I stop with `Ctrl`+`Alt`+`F1` then login and               $ sudo /etc/init.d/gdm stop      Then I go about my debugging. then restart gdm with               $ sudo /etc/init.d/gdm start      and I get back the login screen when I login yet again, and execute "users" and get back               $ users     aredd aredd aredd aredd      making me think that my I'm still logged in form the first time, the terminal without gnome, gnome again, and another instance. If my old gnome session is still logged in how do I resume that session instead of starting a new one?


title: Which minimal but extendable Linux distribution to choose

text: I need an extendable Linux distribution which I can easily reduce in size so much that it fits into a 64 mb CF card. In this stripped version it will run on a Via C7 and needed is Kernel, networking, a shell, basic perl and a ftp server. There are some distributions for embedded systems which can do this, however I have the requirement that it should be possible to to expand this set in the future, e.g. to a basic X setup or python instead of perl etc. Which distribution do you know which can do this? Can any one of the major distributions like Fedora, Debian, Ubuntu be stripped down so much? Edit: I looked at Embedded Debian which seems pretty close to what I need. Sadly, development seems to have stalled due to health problems of the main maintainer.


title: Graceful shutdown in ArchLinux

text: I'm trying to get a graceful shutdown/reboot in ArchLinux with GNOME Shell. Now, when I ask for shut-down, it immediately shuts down without giving open programs time to gracefully close / save open files. As a result, whenever I restart Chrome (for example) it tells me that the session was not closed correctly etc. By reading on the web I learnt that systemd while shutting down processes, it first send a `SIGTERM` followed by `SIGKILL` if the process does not close withing a given timeout. However I notice that on my system `SIGKILL` is sent immediately after `SIGTERM` and I guess this is the cause of a non graceful programs termination. I've found some documentation which (if I read it correctly) states that timeout before sending `SIGKILL` can be set by `TimeoutStopSec=` option. Also sending `SIGKILL` could also be disabled by `SendSIGKILL=` option. But I cannot find where to configure those options... is there a systemd shutdown / reboot configurations file where I can set those options? **EDIT:** I did some test and I discovered two interesting things:   1. If I manually close chrome like this `killall -SIGTERM chrome`, it will not complain that is has not been closed correctly next time I start it again. If I close it like this instead `killall -SIGKILL chrome`, it will complain. This tells me that chrome is handling SIGTERM correctly.   2. Looking at the output of my shutdown procedure, systemd prints `Sending SIGTERM...` immediately followed by `Sending SIGKILL...` According to comment below, systemd is handling its processes only. So in my case GDM. This tells me that the issue could be:   1. either GDM not closing it's child processes (e.g. Chrome) correctly (i.e. by sending SIGTERM to them)   2. or systemd is sending GDM a SIGKILL message to early not giving it the time to correctly close its children. Is there a way to check/configure how actually GDM closes its children?


title: Strange problem with synchronized clipboards

text: I'm using Parcellite with synchronized clipboards and I ran into a funny problem: I can't use clipboard for renaming a file with Nautilus. Anytime I press `F2` the basename of the file gets selected thus overwriting my clipboard content. I can't even use Parcellite's history, since pressing `Ctrl``Alt``n` open the history window, lets me re-select what I want, but Nautilus loses focus and the rename action is over. How to solve it? Is there a clipboard manager having a key combination allowing to scroll through the clipboard history, similar to `Alt``y` (yank-pop) in Emacs?


title: Why is the temporary system needed to build a Linux from Scratch?

text: I just quickly read the Linux From Scratch book and found it very interesting. However I don't understand the role of the temporary system (Chapter 5). It is built from a working distribution, and then we use it to build the final system. Couldn't we just make a partition and build a system on it ?


title: How to properly unplug/plug removable LVM2 device?

text: How to properly unplug (remove) and later plug (insert) removable (hot-plug, usb etc) storage device with LVM2 on it ? I've found this note Remove (unplug, eject):               lvchange -an /dev/your_volume_group_name     vgexport -a      Insert (plug):               vgimport -a     lvchange -ay /dev/your_volume_group_name      but I'm unsure if using "all" option `-a` isn't and overkill ? Another thing, I wonder if there might be in some circumstances need of using `vgscan` `pvscan` in such scenario ? I'm thinking about automatized solution.


title: File inventories and logrotation

text: I want to collect a huge amount of data files on my actual netapp storage with the command `file - f /path... > logfile.txt`. Through the huge data amount, the size of the logfile will be critical. So I want the use a command/option like logrotate, to split every logfile to a filesize, e.g. 5MB. Can anybody help me to fix my script?


title: Get last changed content since last read

text: How can I get the last changed content of a file, since its last read? Something more precise that this:               tail - <nr >file_1.txt >file_2.txt      where file_2.txt gets the last modified content.


title: I can't find my soundcard using lspci; does that mean it's not linux's fault?

text: Pretty straightforward question, and according to this diagram it would seem the answer is _yes_. My previous sound card stopped working (ie. stopped appearing when I ran `lspci`) so I bought a 2nd hand `Audigy 2 zs`, thinking the old sound card had died. However, I'm having the same problem with this sound card. I've followed the usual steps of disabling on board sound and reinstalling `alsa` (although I'm thinking that `alsa` probably has nothing to do with this issue). So since I've now had 2 soundcards not showing up when I run `lspci`, is it time to consider getting a new motherboard, or could this still be just a linux thing? I'm using `Debian jessie`, although the issue did not start when I upgraded.


title: Does epoll give available bytes to read or write, and threshold feature?

text: kqueue gives available bytes to send or receive if file descriptior (such as socket) gets signal. and, kqueue gives threshold feature, for example, it does not signal until sufficient bytes are available to read or write if user wants. Are these two features also given by epoll? I googled for it but I couldn't find them yet.


title: Problem with RA streaming with mplayer

text: I am trying to play a .ra streaming with mplayer from this url:               rtsp://mm6.rai.it/radiofonia/radio3/napoli/battiti/2012/battiti2012_10_04.ra      I use to execute the command `mplayer rtsp://url.ra`, but now this seems doesn't work               MPlayer2 UNKNOWN (C) 2000-2011 MPlayer Team     mplayer: could not connect to socket     mplayer: No such file or directory     Failed to open LIRC support. You will not be able to use your remote control.          Playing rtsp://mm6.rai.it/radiofonia/radio3/napoli/battiti/2012/battiti2012_10_04.ra.     Resolving mm6.rai.it for AF_INET6...          Couldn't resolve name for AF_INET6: mm6.rai.it     Resolving mm6.rai.it for AF_INET...     Connecting to server mm6.rai.it[212.162.85.53]: 554...          librtsp: server responds: ''     librtsp: server responds: ''     rtsp: read error.     librtsp: server responds: ''     Cache size set to 640 KBytes     Cache fill:  0.00% (0 bytes)             Cache not filling, consider increasing -cache and/or -cache-min!     Detected file format: REAL     Stream description: Audio Stream     Stream mimetype: audio/x-pn-realaudio     [real] Audio stream found, -aid 0     RM: No audio stream found -> no sound.     No stream found.               Exiting... (End of file)      After a little googleing i have found that the problem is libav, so I have probed the command `mplayer --demuxer=lav rtsp://url.ra`               MPlayer2 UNKNOWN (C) 2000-2011 MPlayer Team     mplayer: could not connect to socket     mplayer: No such file or directory     Failed to open LIRC support. You will not be able to use your remote control.          Playing rtsp://mm6.rai.it/radiofonia/radio3/napoli/battiti/2012/battiti2012_10_04.ra.     Resolving mm6.rai.it for AF_INET6...          Couldn't resolve name for AF_INET6: mm6.rai.it     Resolving mm6.rai.it for AF_INET...     Connecting to server mm6.rai.it[212.162.85.53]: 554...          librtsp: server responds: ''     librtsp: server responds: ''     rtsp: read error.     librtsp: server responds: ''     Cache size set to 640 KBytes     Cache fill:  0.00% (0 bytes)             Detected file format: RealMedia format (libavformat)     Cache not filling, consider increasing -cache and/or -cache-min!     [lavf] stream 0: audio (cook), -aid 0     Clip info:     title: BATTITI DEL 04.10.2012     author: BATTITI     copyright: Copyright © 1997 2000 Netia Digital Audi     comment:      ==========================================================================     Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders     ad_ffmpeg: initial decode failed     ADecoder init failed :(     Could not open audio decoder ffmpeg.     Opening audio decoder: [realaud] RealAudio decoder     Error: /usr/lib/codecs/cook.so: cannot open shared object file: No such file    or directory     Win32 LoadLibrary failed to load: /usr/lib/codecs/cook.so     Error loading dll     ERROR: Could not open required DirectShow codec cook.so.     Read the RealAudio section of the DOCS!     ADecoder preinit failed :(     Could not open audio decoder realaud.     Opening audio decoder: [realaud] RealAudio decoder     AUDIO: 22050 Hz, 1 ch, s16le, 20.7 kbit/inf% (ratio: 2583->0)     Selected audio codec: [racook] afm: realaud (RealAudio COOK)     ==========================================================================     [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or  directory     AO: [alsa] 22050Hz 1ch s16le (2 bytes per sample)     Video: no video     Starting playback...               MPlayer interrupted by signal 8 in module: decode_audio      The command `mplayer -ac help` tell me that the `cook.so` codec is present               ...     ...     ra10cook    realaud   working   RealPlayer 10 COOK audio  [cook.so]     racook      realaud   working   RealAudio COOK  [cook.so.6.0]     ...      I am using the latest version of linux mint with kernel 3.2.0. **EDIT:** If I download the streaming before and eventually play it with mplayer all works fine. Where is the problem?


title: Generate a key (number?) based on part of the machine's hardware components

text: I'm wondering what is the best way to manually generate a hardware key based on certain components of the machine. Here's the thing: I want only certain type of machines to be able to communicate with my server. In order to do that, I'd like to make sure that their hardware is just part of the "allowed hardware" that my server recognizes (or accepts). I would like to generate a key based on said hardware so I can check it on the server side and make sure that it's among the "allowed ones". Ideally, it would "check"   * Processor    * Motherboard   * Ethernet network interface Memory and hard drive are a bit tricky, because those may change pretty often. I am using Ubuntu 10.10 and I have seen the `lshw` command which provides pretty much information about... well... about everything. Also, cat `/proc/cpuinfo`, `dmidecode`... All of them show a lot of information which I can always parse with regular expressions and do... things, but I was wondering if there's a cleaner more direct way. Any hint or suggestion in this matter will be appreciated. Thank you.


title: Sending to two bluetooth speakers at once

text: Is it possible to send the same audio signal to two different Bluetooth speakers at once from a single source? I remember reading somewhere that it's possible to send audio to two different sinks using PulseAudio, but I'm not sure if that applies to Bluetooth speakers or if Bluetooth has a built in limitation on something like this. I want to be sure that I can actually accomplish what I'm setting out to do before I purchase Bluetooth speakers and a dongle.


title: Turn a bash and php script into a distributable rpm

text: I'm semi unix knowledgeable and I want to be able to call down an rpm from my server, run it with something like rpm -i , and have access to the script anywhere. The script is a combination awk and php that does some processing. It doesn't require any special version of either or any special libraries. I think the php could even use 4. Awk is old as time. The order and usage statement is stored in a wrapping .sh . How do i 1. turn it into an rpm that 2. puts it in /usr/bin (or a runnable folder) though i would prefer it's own subfolder since it's two files. I will be mostly targetting centos but perhaps other shells. I don't think it matters.


title: Command line audio - piping for simultaneous playback and recording

text: I am trying to generate sound data, convert it and store it to a WAV format. I'm almost there - except I'd like to hear the generated sound "while" it is being "recorded". This command line just generates data and plays it back:               perl -e 'for ($c=0; $c<4*44100; $c++) {                  $k=1*sin((1500+$c/16e1)*$c*22e-6); print pack "f", $k;              } ' |     aplay -t raw -c 1 -r 44100 -f FLOAT_LE       _(Note that if you press Ctrl-C here after sound stops playing,`aplay` may segfault)_ Using `sox` and `mplayer`, I can record fine - but I can hear no sound at the same time:               perl -e 'for ($c=0; $c<4*44100; $c++) {                  $k=1*sin((1500+$c/16e1)*$c*22e-6); print pack "f", $k;              } ' |     sox -V -r 44100 -c 1 -b 32 -e floating-point -t raw - \         -c 2 -b 16 -t wav - trim 0 3 gain -1 dither |     mplayer - -cache 8092 -endpos 3 -vo null -ao pcm:waveheader:file=test.wav      Note here that `play test.wav` (where `play` is from `sox` package, not `alsa`'s `aplay`) will state "Duration: 00:00:03.00" for the `test.wav` file. Also, this process seems to run faster than realtime (i.e. completes in (apparently) less than 3 secs). By trying to cheat by using `tee` to capture the stream to disk,               perl -e 'for ($c=0; $c<4*44100; $c++) {                  $k=1*sin((1500+$c/16e1)*$c*22e-6); print pack "f", $k;              } ' |     sox -V -r 44100 -c 1 -b 32 -e floating-point -t raw - \         -c 2 -b 16 -t wav - trim 0 3 gain -1 dither |     tee test.wav |     aplay      Here apparently I get to hear the sound as it is generated - and `test.wav` is playable as well, however, `play test.wav` will report "Duration: unknown". So I'd like to ask - is it possible to do something like the above "one-liner" command line, to both generate, play and record a sound "at the same time" - however, _without_ the need to install `jack`? PS: some relevant links:   * notes on linux audio file formats   * » Mplayer doesn’t stream from stdin without cache setting Dag Olav Prestegarden   * command line - How to convert 16bit wav to raw audio - Stack Overflow   * Old Nabble - linux-audio-dev - audio recording through pipe using mplayer and sox sometimes has incorrect speed   * How to redirect the ALSA output to a file? | Software View   * Can I setup a loopback audio device? - Unix and Linux - Stack Exchange


title: Remap CapsLock to Escape and Control System Wide

text: Is it possible to remap the CapsLock key system wide such that when the CapsLock button is pressed by itself it acts as the escape key and when pressed with another key it acts as the control key?


title: Getting newer version of GEOS than what is available in Debian repositories

text: I need to install a GEOS version >= 3.2.2, and doing so is beyond my current aptitude (pun intended). The current Debian squeeze version is 3.2.0, which will not work for my purposes (using the `rgeos` package in R). I've tried the following:   * Installing the 3.3.3 package from the Debian wheezy repository via `dpkg -i`   * Installing several 3.2.2 packages from the Ubuntu repository. All fail because I need `libstdc++6 (>=4.6)` and I have version 4.4.5-8. I assume that what I need is to install a newer libstdc++6, but I want to do so in a way that doesn't break existing packages. Is it possible to have two versions installed at once, with the newer one being used only for GEOS? And if so, how do I do that. **Update** As per @Marco's suggestion, I've compiled GEOS and it compiles/installs properly but with both 3.3.3 and 3.2.3 I get the following error when I try installing the `rgeos` package in R:               * installing *source* package ‘rgeos’ ...     ** package ‘rgeos’ successfully unpacked and MD5 sums checked     checking geos-config usability... yes     configure: geos-config: geos-config     configure: GEOS version: 3.2.3     checking geos version over 3.2.1... yes     checking geos-config clibs... no     checking for gcc... gcc -std=gnu99     checking for C compiler default output file name... a.out     checking whether the C compiler works... configure: error: cannot run C compiled programs.     If you meant to cross compile, use `--host'.


title: How to adjust column width in Linux command output

text: When I used this command on Red Hat Linux               /usr/sbin/ss -i      I get the following output below:               State       Recv-Q Send-Q                                            Local Address:Port                                                Peer Address:Port     ESTAB       0      0                                                    <IP_ADD:PORT>                                                  <IP_ADD:PORT>              ts sack wscale:2,2 rto:204 rtt:4.5/6.5 ato:40 cwnd:3     ESTAB       0      0                                                    <IP_ADD:PORT>                                                  <IP_ADD:PORT>              ts sack wscale:2,2 rto:213 rtt:13.875/18.5 ato:40     ESTAB       0      0                                                    <IP_ADD:PORT>                                                  <IP_ADD:PORT>              ts sack wscale:2,2 rto:201 rtt:1.875/0.75 ato:40     ESTAB       0      0                                                    <IP_ADD:PORT>                                                 <IP_ADD:PORT>              ts sack wscale:9,2 rto:201 rtt:1.875/0.75 ato:40      Whenever I try to pipe `grep` to that command `ex`:               /usr/sbin/ss -i | grep <SOME_IP_ADD>      I have this output               ESTAB      0      0              <IP_ADD:PORT>           <IP_ADD:PORT>     ESTAB      0      0              <IP_ADD:PORT>           <IP_ADD:PORT>     ESTAB      0      0              <IP_ADD:PORT>           <IP_ADD:PORT>      Notice that grep didn't include this:               ts sack wscale:2,2 rto:204 rtt:4.5/6.5 ato:40 cwnd:3      because its on another line. So how do I adjust the column width whenever I use this command or other Linux commands for that matter. So that the output will not word-wrap or go to the next line? Are their better ways of doing this?


title: Invoking a script with ld-linux.so?

text: I just downloaded a `tar` file that is supposed to include everything required to run a program that we can call `some_binary`. I extracted it's contents, and I see the following:   * A binary (let's call it `some_binary`)   * A `lib` folder with various dynamic libraries (.so files) such as `/lib/ld-linux-x86-64.so`   * and a shell script called `some_binary.sh` The script has the following contents:               #!/bin/bash     `dirname "$0"`/lib/ld-linux-x86-64.so.2   `dirname "$0"`/some_binary "$@"      and running it as `./some_binary.sh some arguments` seems to run `./some_binary` correctly. Oddly enough, running the following script:               #!/bin/bash     LD_LIBRARY_PATH=$CWD/LIB:$LD_LIBRARY_PATH     ./some_binary "$@"      as `./my_script.sh some arguments` does not work. It results in relocation errors (undefined symbols), presumably from incorrectly loading the libraries under `./lib` Moreover, running the following two statements from the command line results in `segmentation fault`:               > LD_LIBRARY_PATH=$CWD/LIB:$LD_LIBRARY_PATH     > ./some_binary some arguments      With this, my questions are:   1. What does the first script do?    2. Why do I get different results across these three attempts? and why can't I just add `$pwd/lib` to `LD_LIBRARY_PATH` and then run `some_binary` directly?


title: Why `rename` behaves differently whenever I use full path instead current path?

text: Ok, I'm answering a question where the OP have several repositories in Ubuntu that might be causing a problem installing unrelated software. I recommend disabling the PPA's using a single liner `rename` then follow a series of instructions. Everything fine, and I just leave that question behind as answered.... no. Results that `rename` didn't behave as I'm expecting to:               sudo rename s/list/list\.disable/g /etc/apt/sources.list.d/*.list      With this I'm expecting rename to look into `/etc/apt/sources.list.d/` any file ending in `.list` and replace the `.list` with `.list.disable`. I had another answer with almost the same command but OP never gave feedback, and I'm kind of throwing the theory without testing first. So, it's by my surprise that OP find problems with the line:               Can't rename /etc/apt/sources.list.d/iaz-battery-status-quantal.list /etc/apt/sources.list.disable.d/iaz-battery-status-quantal.list.disable: No such file or directory     Can't rename /etc/apt/sources.list.d/ubuntu-wine-ppa-quantal.list /etc/apt/sources.list.disable.d/ubuntu-wine-ppa-quantal.list.disable: No such file or directory     Can't rename /etc/apt/sources.list.d/webupd8team-java-raring.list /etc/apt/sources.list.disable.d/webupd8team-java-raring.list.disable: No such file or directory      I get a weird feeling so I test the theory myself, and see the same result. Then, whenever you get a problem is normally regex, no? I changed the regex in so many twisted ways:   * s/.list/.list.disable/g   * s/.list/.list.disable/g   * /list/list.disable/   * other combinations that I don't remember Well, I decided that regex was not the problem, so I glare to the selector, and change it for `/etc/apt/sources.list.d/*` and recycle the regex test. No joy. Getting a bit frustrated I do `touch some.list` and apply my command               rename s/\.list/\.list\.disable/g *      Bingo! Now I feel trolled all over. I fix my answer and continue with my life... no! This is not acceptable. Why? I look up the manual which, for my surprise uses only current path examples. Is this normal? Or is just that the function wasn't implemented? Or I should start to mistrust my theories?


title: No module Found error in Linux but Works fine in Windows

text: I am trying to run a Program that I coded in Python in Windows environment When I am trying to copy the program and running it in Linux(Debian), It won't work, It is giving the following error,               Traceback (most recent call last):       File "BlackBox.py", line 26, in <module>         from BB_Files import BB_Expand     ImportError: No module named BB_Files      Despite the presence of the file BB_Expand inside BB_Files folder, I am still getting the error. I have also tried appending the path of my current directories in Python,               sys.path.append("/home/pe/Desktop/AES")     # Sub-Folders of AES are also accessible     sys.path.append("/home/pe/Desktop/AES/BB_Files")      But Still no Luck, This is the File Structure,               /home/pe/Desktop/AES/Main.py     /home/pe/Desktop/AES/BB_Files     /home/pe/Desktop/AES/BB_Files/BB_Days.py     /home/pe/Desktop/AES/BB_Files/BB_Expand.py     /home/pe/Desktop/AES/BB_Files/BB_Steps.py       this is the output of `ls -l` command,               drwxrwx--x 4 pe users  4096 Oct 26 21:43 BB_Files     -rw-rw---- 1 pe users 15284 Oct 26 22:04 Main.py      This is some initial code in the file,               import sys    # sys.argv ; sys.path, sys.exit     import os     import hashlib     import struct # Interpret strings as packed binary data     import getopt # for Runtime arguments     import time     from datetime import date          # Append Paths from where the Files would be Imported.     sys.path.append("/home/pe/Desktop/AES")     # Sub-Folders of AES are also accessible     sys.path.append("/home/pe/Desktop/AES/BB_Files")     # Sub-Fodlers of BB_Files are also accessible now (Tables)     from BB_Files import BB_Expand     from BB_Files import BB_Steps     from BB_Files import BB_Days      This is the line giving an error,               from BB_Files import BB_Expand      The program doesn't run after this line because the Python couldn't find this Module. The same code works absolutely fine in Windows. could anyone please help me out with this ?


title: How can I set "vi" as my default editor in UNIX?

text: I believe I can do something like `export EDITOR=vi`, but I'm not sure what exactly to enter, and where. How can I set "vi" as my default editor?


title: How to skip (omit) a sepcific port in nmap

text: With nmap, I want to skip the scan on port 80. I'm sure this is in the man somewhere, but I haven't found it so far. My command is simple:               nmap 24.0.0.1\24      So this will scan ports in the 24.0.0.x range; I just need to avoid port 80 (for stealth reasons).


title: Qtiplot installation on Slackware

text: I need to install QtiPlot on my Slackware system. I have got the package from Slackbuilds.org, but each time during installation I am getting this following error: > unzip: cannot find or open > /home/avinash/slackbuilds/QtiPlot/QTeXEngine-0.3-opensource.zip, > /home/avinash/slackbuilds/QtiPlot/QTeXEngine-0.3-opensource.zip.zip or > /home/avinash/slackbuilds/QtiPlot/QTeXEngine-0.3-opensource.zip.ZIP..


title: ncmpc - spaces in search query

text: How can I use spaces in my search query in ncmpc (window 5), when looking for a particular type of tag? For example,               artist:radiohead      works. But,               artist:owl city      doesn't. I've tried thing like:               artist:'owl city'     artist:"owl city"     artist:owl\ city     artist:{owl city}      but none of that works. Thank you


title: Exporting environment variable

text: I am having some problem with bash. I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the export process. i.e.               export STY=for i in {0..3}; do echo $i; done      so my requirement is that when I echo STY, the output that I need should be               echo $STY     for i in {0..3}; do echo $i; done       But $i is evaluated during export. I need to preserve it as it is. Thanks alot for your help.


title: How can I use a loop inside a command?

text: I'm writing a shell script that contains a command that takes multiple directories as space-separated input arguments (like `ls`). I would like to fill in those arguments from a variable but don't know how to ensure words like "for" aren't interpreted as arguments. Here's an example that expresses my idea:               #!/bin/bash          dirs="      $HOME/Documents      $HOME/Music     "          ls \     for dir in $dirs     do         "$dir "     done


title: Is there an easy way to switch playback soundcards?

text: I recently purchased the roccat kulo headset which comes with a nice USB soundcard, completely functional under linux :). Howsoever I now struggle to easily siwtch between my laptops integrated soundcard, connected to my stereo and my headset connected by the roccat soundcard. Running `aplay -l` retureturns the following: > _**_List of PLAYBACK Hardware Devices ****   >  card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]   >  Subdevices: 1/1   >  Subdevice #0: subdevice #0   >  card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]   >  Subdevices: 1/1   >  Subdevice #0: subdevice #0   >  card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]   >  Subdevices: 1/1   >  Subdevice #0: subdevice #0   >  card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]   >  Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Kulo [ROCCAT Kulo], > device 0: USB Audio [USB Audio] Subdevices: 1/1   >  Subdevice #0: subdevice #0 I know I could provide a `.asoundrc` howsoever I'd prefer a more straight forward way to switch the output device globally. Meta: I use ALSA


title: xdg-mime not behaving

text: I am trying to set the default application for magnet links using:               ~ $ xdg-mime default deluge.desktop x-scheme-handler/magnet      Checking this with `grep -i deluge ~/.local/share/applications/* ` yeilds:                /home/manko/.local/share/applications/mimeapps.list:x-scheme-handler/magnet=deluge.desktop      /home/manko/.local/share/applications/mimeapps.list:application/x-bittorrent=deluge.desktop      i.e. it should have worked right?!? c.f:               ~ $ xdg-mime query default x-scheme-handler/magnet     deluge.desktop      However when I run `xdg-open magnet:?xt=urn:btih:6fa3fa92...` chromium fires up! I'm stumped.


title: Running md5sum on a file's contents

text: `md5sum`ing a file is fine, but I cannot seem to invoke `md5sum` to calculate the hash based only on the file's contents. (For those wondering, I'd prefer that multiple `wget`s of the same file return the same md5 hash. `md5sum`ming the file keeps reporting different hashes because the timestamp on the file is different.)               julian@julian-computer:/tmp$ md5sum < `cat index.html`     bash: `cat index.html`: ambiguous redirect


title: How to combine bash command grouping and pipe status

text: How do I combine bash command grouping and pipe status? This is an example command group:               { tar -cf - my_folder 2>&1 1>&3 | grep -v "Removing leading" 1>&2; } 3>&1 | gzip --rsyncable > my_file.tar.gz         This is an example pipe status readout to go with the above:               [[ ${PIPESTATUS[*]} =~ [1-9] ]] && rm my_file.tar.gz         In this example, the command group keeps mail spool free of warnings about "Removing leading /" from tar, being delivered via cron because they land on stderr (Unices lack a stdwarn and tar lacks a quiet option), while letting real errors pass through. The pipe status readout makes sure that corrupt backup files are immediately removed, to prevent a later cleanup using a standard FIFO algorithm from removing older valid files. But this example does not work. In the above, the pipe status contains [1 0], that is, the exit code of grep and gzip, but not tar. One attempt I tried was this:               { tar -cf - my_folder 2>&1 1>&3 | grep -v "Removing leading" 1>&2; GROUPSTATUS=${PIPESTATUS[*]}; } 3>&1 | gzip --rsyncable > my_file.tar.gz     [[ $GROUPSTATUS =~ [1-9] ]] && rm my_file.tar.gz      But GROUPSTATUS is empty upon leaving the group. (Note that by setting GROUPSTATUS to anything other than the pipe's status, eg. a literal of some sort, it can be verified that the variable does in fact escape the command grouping scope under normal circumstances.) I've also tried if `return` from within the group can deliver the first pipe component's exit code to the outside, but return inside a command group just yields an error message from bash.


title: How do idiomatic Unix programs detect what prefix they are installed under?

text: If I install a binary with non-standard prefix, e.g. `/opt/bin/foo`, which needs some static files from `/opt/share/foo`, how does it find them? Using back references relative to the executable (`../share/foo`)? Hardcoded at compile time? What's the _idiomatic_ way for an application to handle variable installation prefix? Should all directories be prefixed? (what about `/var`?)


title: ifconfig shows an IP out of the lan range

text: I have set router IP to 192.168.112.20 and starting IP address to 192.168.112.25. But when I run `ifconfig` command it shows the following IPs: `inet addr: 192.168.174.12 Bcast 192.168.174.255 Mask:255.255.255.0` in Network manager in IPv4 Settings, Method is set to _Automatic (DHCP)_ Why they're not in defined range?


title: "which" equivalent for shared libraries

text: I am looking for a utility that would behave in the same way as `which`, but to look up shared libraries (*.so) in the directories defined in $LD_LIBRARY_PATH?


title: GNU screen status bar - how to make it display shell session names?

text: Let's say I have several shell "tabs" (or screens? sessions?) named bash1, bash2, etc. open in GNU screen. I want the status bar (i.e., the caption line) to display the names as "bash1 | bash2 | ..", with the currently open tab and the last open tab clearly marked. How do I make this happen with my `.screenrc`?


title: Simple terminal emulator that supports cut/paste with other programs?

text: Coming from Mac OS X, I've enjoyed being able to cut/copy/paste text to and from its built in Terminal application. Now, I am planning to migrate to a tiling window manager like scrotwm, xmonad, etc., but all I've got right now is xTerm. I can't get it to accept cut/paste. Is there another terminal emulator that accepts cut and paste from other programs' windows? (by the way, I hope the encoding will support UTF-8)