title: Memory size for kernel mmap operation

text: I'm interested in the way Linux mmaps files into the main memory (in my context its for executing, but I guess the mmap process is the same for writing and reading as well) and which size it uses. So I know Linux uses paging with usually 4kB pagesize (where in the kernel can I find this size?). But what exactly does this mean for the memory allocated: Assume you have a binary of size of a few thousned bytes, lets just say 5812B and you execute it. What happens in the kernel: Does it allocate 2*4kB and then copy the 5812B into this space, wasting >3KB of main memory in the 2nd page? Probably a very simple question, I just want to make sure I got it right. + It would be great if anyone knew the file in the kernel source where the pagesize is defined. My 2nd question is also very simple I guess: I assumed 5812B as a filesize. Is it right, that this size is simply taken from the inode?


title: Looking for a distro with GUI fit for Windows 98 PCs

text: I have a Windows 98 computer that we still use (the hardware works just fine, but Windows is becoming a bit flaky and I'd rather go problem hunting and solving with Linux rather than Win98). I'm looking for a _very_ lightweight distribution (with a GUI, not command line) that is able to run the following:   * An email client which supports POP3    * A "more up to date" web browser (the banking website refuses to show up in the old Internet Explorer version it's running)   * An app able to open and modify Word and Excel documents   * FTP, DropBox, or some way to share and sync files with another computer That is ALL the software that's needed (though, having Skype support would be helpful, but not required) It uses a Pentium II Processor, which means it's CPU is between 233 MHz and 450 MHz (I can't seem to find the exact number from within Windows), and 256 MB RAM.


title: Why are files in my home dir being created as world-writable despite a more-restrictive umask?

text: I've realized that the permissions for new files and directories behave a bit strangely. First of all, umask seems to return the right answer:               $ umask     0002      This means full access for my user and my group, no write access for the rest of the world, no suid. But if I create a file in my $HOME, this is how it looks:               $ ls -l testfile      -rw-rw-rw- 1 robe robe 0 mar 16 12:58 testfile      i.e. , giving write access to everyone. The same happens with directories:               $ ls -ld testdir     drwxrwxrwx 2 robe robe 6 mar 16 13:00 testdir      I think this is the same as having umask 0000, not 0002. I've searched all /etc for some instance of umask that changes the default 0002 or 0022, but found none. This is a default CentOS 5.5 install. Any hint of why is this happening?


title: How to blacklist bad blocks from a MD-raid + dm-crypt + ext4?

text: I have a ext4 partition, on top of a dm-crypt, on top of a MD-RAID 10. One partition (`/dev/sdc1`) dropped out of the array with a ton of read errors. I ran the manufacturer provided diagnostic tool and it reported no errors (or maybe fixed things). I ran `badblocks` on `/dev/sdc1` and it reported a few bad blocks. `/var/log/messages` was filled with several errors for `sdc` reporting "Unrecovered read error - auto reallocate failed" I know I can use `fsck` to add a block to the ext4 bad blocks list, but I don't know if a block on `/dev/sdc1` corresponds to the same block on the mdraid + dm-crypt + ext4.


title: Extract lines from a text file with one column equal to the maximum

text: I have a text file (with header line) called file.txt. I am trying to extract the lines equal to the maximum value of a specific column (I do not know what the max value is):               ID t1 q1 t2 q2 q3      1 f 45 ex 1 45     2 r 47 tr 1 33     3 r 33 ex 2 44     4 f 44 s 0 55     5 e 32 ex 0 54     6 f 34 tr 2 46      I need to find the maximum value of column $5 and then print only the lines with column 5 equal to this number:               3 r 33 ex 2 44     6 f 34 tr 2 46      I think the following code works, but my file is huge and it takes a vary long time, so I am looking for a faster solution (maybe using sort?): This is what I have for now: Fist find the max value:               max=`awk '{print $5}' file.txt | sort -nr | sed -n 2p`      Then select the lines where column 5 is equal to this value:               awk 'NR>1' file.txt|while read LINE; do value=`echo $LINE|awk '{print $5}'`; if [ $value -eq $max ]; then echo $LINE >> test.txt; fi; done


title: clear(1) after detach in GNU screen

text: I run irssi in screen and I want screen to automatically blank the terminal (scrollback) after detach. I found out that screen has a command called "blanker" that can clear the screen, but I don't see a way to do it automatically after detach (whether remote or via C-a d). Thanks in advance


title: How to check password with Linux?

text: I want to check, from the linux command line, if a given cleartext password is the same of a crypted password on a /etc/shadow (I need this to authenticate web users. I'm running an embedded linux.) I have access to the /etc/shadow file itself.


title: What is the native Gnome equivalent for Kile?

text: I was using Kile for editing Latex documents, but after latest package upgrade (I am running Debian Testing) all Kde applications are running reeeeaaaallllly slow - so I am looking for a temporary Gnome based (GTK) substitute. I am looking for an application that will allow me to edit text, highlight syntax, have a button to run pdflatex (and ideally bibtex if needed, and then pdflatex again etc.), another button for viewing the latest pdf. Syntax and reference completion would be a bonus.


How can I exclude files by default with rsync? Here is how my normal rsync syntax starts out:               rsync --exclude ".ht*" --exclude "error_log" --exclude ".DS*" --exclude "old" ...      I've seen a lot of mention of configuring the `/etc/rsyncd.conf` file, but maybe that's more for the daemon than the rsync command. Is it possible to have some default excludes for rsync when called from the command line like in my default syntax above?


title: External Dell monitor has ghosting effects on dropdowns and terminals

text: I have an external monitor setup that works perfectly in windows, but in linux mint I get weird ghosting effects in the monitor. the monitor is a DELL SP2309Wc with resolution of 2048 x 1152 No ghosting when the mouse is on the laptop screen I am using a hdmi cable


title: When exactly does tmpwatch clear out files I place in /tmp?

text: CentOS 6.x I'm confused on when exactly files I place in /tmp/ are deleted. /etc/cron.daily/tmpwatch has the following:               #! /bin/sh     flags=-umc     /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \             -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \             -X '/tmp/hsperfdata_*' 10d /tmp     /usr/sbin/tmpwatch "$flags" 30d /var/tmp     for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do         if [ -d "$d" ]; then             /usr/sbin/tmpwatch "$flags" -f 30d "$d"         fi     done      The section in line 5 that reads `-X '/tmp/hsperfdata_*' 10d /tmp` leads me to believe that files I place in /tmp/ will remain for 10 days (assuming they aren't locked during deletion of course or the directory is mounted on a tmpfs file system). Is that correct?


title: How to reverse a string made of digit in bash?

text: What is the best way to turn out digits in number? E.g.               $ echo 123 | hook     321     $ echo 12358 | hook     85321


title: Where is udev getting the ID for iSCSI devices?

text: I'm using iscsi-initiator-utils successfully to use some iscsi devices on CentOS 5, and I have some symlinks created by udev in /dev/disk:               # ls -l /dev/disk/by-path/ip-* /dev/disk/by-id/scsi-*     lrwxrwxrwx 1 root root 9 Sep 29 15:41 /dev/disk/by-id/scsi-14f504e46494c45006779706e4d772d746d36582d6869556e -> ../../sdb     lrwxrwxrwx 1 root root 9 Sep 29 15:41 /dev/disk/by-path/ip-192.168.20.149:3260-iscsi-iqn.2006-01.com.openfiler:tsn.0a16ba8cb6c9-lun-0 -> ../../sdb      I know that the by-path one is the IQN of the device, and I presume that the by-id one is a SCSI device identifier. I would like to know how to get these values myself from e.g. /dev/sdb. `scsi_id -g /dev/sdb` returns nothing. (I know I could map symlinks back and scrap the IDs from the filenames, but that would be redundant: udev is getting those IDs from somewhere, and I'd like to know where).


title: How to setup openvpn client on linux mint

text: I am used to setting up the openvpn clinet on windows 7. How do I setup openvpn clinet on linux mint? I can't find a gui or a simple way to do so. My gui is **nautilus**


title: Does git pull after init remove untracked files?

text: I just made a simple script and created a new repository for it on GitHub. After initializing the local repo, moving the script to the repository and `pull`ing the GitHub repository (containing only a `README.md` file), the script was gone. Is this normal behavior? And is there some way to restore the file? Here are the commands, as executed:               $ mkgithub ~/dev/cr2meta2jpg     Initialized empty Git repository in /home/username/dev/cr2meta2jpg/.git/     $ mv test.sh ~/dev/cr2meta2jpg/cr2meta2jpg.sh     $ cd ~/dev/cr2meta2jpg/     $ ls     cr2meta2jpg.sh     $ git pull     remote: Counting objects: 3, done.     remote: Compressing objects: 100% (2/2), done.     remote: Total 3 (delta 0), reused 0 (delta 0)     Unpacking objects: 100% (3/3), done.     From github.com:l0b0/cr2meta2jpg      * [new branch]      master     -> origin/master     $ ls     README.md


title: awk character class mystery

text: I seem to be unable to use a character class for an **awk** regular expression, almost exactly as described here :               user@host:~$ awk -W version     mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan          compiled limits:     max NF             32767     sprintf buffer      2040     user@host:~$ echo "host.company.com has address 192.168.22.82" |awk '/^[a-zA-Z0-9.-]+ has address/ { print $4 }'     192.168.22.82     user@host:~$ echo "host.company.com has address 192.168.22.82" |awk '/^[[:alnum:].-]+ has address/ { print $4 }'     user@host:~$      Does anyone see why the second command fails to find the address field?


title: How to convert SELinux mypol.te file to semanage commands for a script

text: Have setup a special logging directory for MySQL logs. This required me to run the command               grep mysqld /var/log/audit/audit.log | audit2allow -M mypol      a number of times to authorize MySQL to search, open, write etc in the MySQL log directory. The final result was a `mypol.te` file that looks like this:               module mypol 1.0;          require {         type mysqld_log_t;         type mysqld_t;         class dir { write search read remove_name open add_name };     }          #============= mysqld_t ==============     allow mysqld_t mysqld_log_t:dir open;     #!!!! This avc is allowed in the current policy          allow mysqld_t mysqld_log_t:dir { write remove_name search read add_name };      However I want to use the `semanage` command in a script to do this automatically in future builds. Wondering how I can convert the above `mypol.te` into a set of `semanage` commands?


title: What filesystems preferentially reuse blocks from deleted files?

text: Related to this earlier question I asked, I'd like to know what filesystems will preferentially reuse blocks that are freed when files are deleted (if any exist)? I am only interested in stable, well-established filesystems and would prefer those that can be the boot/root partition in a Debian system (though this is not essential). * * * edit:   Responding to a comment, I'd like this behaviour because the fs is for a VM and is contained in a sparse raw image file on the host. If new blocks are allocated, the image file gradually loses it's sparseness over time as files are created/deleted/modified, tending towards the 'non-sparse' size, even if the total storage used on the VM remains basically constant. * * * edit:   According to this forum post, "XFS reuses the just freed blocks very fast". Perhaps XFS is the filesystem I am looking for?


title: tcpdump Filter with certain file types?

text: I use the unix command `tcpdump` with these extensions `-A -s0 -ien0 port 80` I know how to add, for example a new host, that would be `and \ host random.com` Can I sniff for certain filetypes? I have tried `filetype xml`, but that doesn't work, there must be a way to do this? Or can I at least make it more easily human readable? But that still output things like this:               ....@jsdiii......23............@win-concon-2---s...@@...@@     http 172. static..@@      And some every (25)? line there is something useful.


title: How to "bond" sshd to only a given interface?

text: How can I limit sshd to only listen on given interface when using OpenBSD 5.3?


title: How to partition an OpenBSD if it's used as a static HTTPD server?

text: So mount options can be useful because it can afaik increase the security of a webserver that is only serving static html files. What are the best mount options/partition schemes for az OpenBSD 5.2 that is used only for static HTTPD server?


title: Running bzImage in QEMU

text: I compiled the kernel by doing `make menuconfig` and `make`. I was trying to run the bzImage in qemu, by doing `qemu -kernel bzImage` but it didn't work out: ![Linux kernel error](http://i.stack.imgur.com/eMx7o.png) How can I fix it? How can I run the bzImage in qemu?


title: Using RSA private key from PuTTY in Filezilla

text: I have created an RSA private key using PuTTYgen. When I try to use it, I am notified that I can't use this encrypted key in Filezilla, so from the documentation I found that I need to use the Pageant tool. Now the problem is I am using Fedora (the latest version), how can I install Pageant? Is there any equivalent of Pageant out there? I am not good with Linux so I need a GUI method.


title: How can I run a command in zsh without pushing it onto the current session's history?

text: Both bash and zsh support a shorthand of not placing a command in history if you prepend it with a space. This works great across sessions (if you've `setopt histignorespace`). However, the command is still in the current session's history. How can I avoid placing a command in the _current session's history_ (or remove if after executing it)?


title: How to set up Motion to access my copied config file?

text: As suggested in this tutorial I made a copy of the Motion configuration file in my home folder under ~/.motion/motion.conf . But Motion then still tries to access the config-file under /etc/motion/motion.conf . How do I fix this behaviour? Here is what I get when I start Motion:               nuc@nuc:~$ motion     [0] **could not open configfile /etc/motion/motion.conf: Permission denied**     [0] Not config file to process using default values     [0] Motion 3.2.12 Started     [0] ffmpeg LIBAVCODEC_BUILD 3547904 LIBAVFORMAT_BUILD 3544067     [1] Thread 1 started     [1] Failed to open video device /dev/video0: No such file or directory     [1] Could not fetch initial image from camera     [1] Motion continues using width and height from config file(s)     [1] Resizing pre_capture buffer to 1 items     [1] Retrying until successful connection with camera     [1] Failed to open video device /dev/video0: No such file or directory


title: SSH config file + shell script help

text: Well, what I want to do seems a bit convoluted but its the only way I can think of to get the result I want. So here goes. I want to automate ssh to my Pi, in the following fashion:   1. My Pi boots up and auto-starts 4 separate instances of screen running bfgminer.   2. Have a shell script on my laptop to ssh into the Pi and open 4 terminals. 1 per screen instance. So I can monitor them all AND control the terminals. I have looked into tmux, but at this point I'm lost. So I'm thinking something along these lines:   1. Pi boots and runs 4 screen instances named USB0, USB1, USB2, USB3 (This is already completed)   2. On my laptop, open terminal and start my shell script. Something like this:              gnome-terminal -e <ssh into pi and open 'screen -d -r USB0'>     gnome-terminal -e <ssh into pi and open 'screen -d -r USB1'>     gnome-terminal -e <ssh into pi and open 'screen -d -r USB2'>     gnome-terminal -e <ssh into pi and open 'screen -d -r USB3'>        3. This will then open 4 terminal windows each automatically connecting to a separate screen instance.  I think this is possible with ssh config file. But I don't know how to do it. I know it should be possible to get ssh to auto login with username and password, and make it call up screen. Maybe have ssh autologin and run a script on the pi to begin screen? I have tried using screen's split screen but its not what I want. And tmux scares me.


title: What is being cached?

text: I have an embedded system with a low amount of memory. The system has allocation issues. Maybe due to fragmentation: Memory allocation issue on NOMMU? The platform is a NOMMU platform and so I suspect that the linux caching is the cause of this fragmentation. Maybe it is, maybe it isn't. The thing is, I can't really see what my system would gain from caching. The system is built from the following partitions:   1. RAM partition. (Kernel, user space fs, etc.)   2. SPI Flash. (Some config data. Maybe a few kb.)   3. SD Card. (Logged data. Will never be read.) Here's the output from my top command:               Mem: 23376K used, 5912K free, 0K shrd, 1624K buff, 8404K cached     CPU:  10% usr  42% sys   0% nic   0% idle  47% io   0% irq   0% sirq     Load average: 1.07 1.00 0.96 2/68 4299     ...      My system has 15M free ram when booted. Within a few minutes more than 60% is used for cache. Normally that wouldn't matter, except if it causing fragmentation issues due to NOMMU difficulties. Now, what is it that the kernel wants to cache anyway? The RAM partition? (Bit foolish.) The SPI Flash? (Good idea. But there's only a few kb there.) The SD card? (It doesn't need caching in this particular scenario.) How do see what is being cached? And how do I reduce the caching scheme? (I really don't need that much caching. There's no gain.) I've tried to mount the sd card and the spi flash with -o sync. But it doesn't make a difference.


title: Postfix unable to send mail from mydomain only

text: My domain DNS is served by the domain registrar. I am able to send mail successfully from any address with postfix but not from mydomain.com From this machine - I only want to be able to send mail. I know it must have something to do with DNS and my domain registrar. When postfix main.cf configuration has               mydestination = localhost, localhost.localdomain      I am getting:               status=bounced (mail for mydomain.com loops back to myself)      When I add mydomain.com to the mydestination (as suggested on the internet)               mydestination = mydomain.com, localhost, localhost.localdomain      I get               status=bounced (unknown user: )      Now I know I am missing something very obvious here, I just can't figure what that is.


title: What information about a process is retrievable after it is terminated?

text: After a process has been terminated, is it possible to retrieve any information about it, such as when it started and finished, &c. Is it possible to enable logging of this information?


title: Unable to install bsddb185, Python library for opening Berkeley DB version 1.85 files on Ubuntu

text: I am writing a python program that makes use of some legacy Berkeley DB 1.85 files. Unfortunately I am unable to install the `bsddb185` Python package, either for Python version 2.x and for Python 3. What I got, using `pip`, is the following error message:               root@ubuntu:~# pip install bsddb185     Downloading/unpacking bsddb185       Downloading bsddb185-1.0.tar.gz       Running setup.py (path:/tmp/pip_build_root/bsddb185/setup.py) egg_info for package bsddb185         Didn't find db.h with HASHVERSION == 2     Cleaning up...     No files/directories in /tmp/pip_build_root/bsddb185/pip-egg-info (from PKG-INFO)     Storing debug log for failure in /home/stab/.pip/pip.log      It appears that I am missing the `db.h` file which should have the constant `HASHVERSION` set at value `2`. I tried to install several Ubuntu packages that include `db.h`, such as `libdb5.3-dev` and `libdb6.0-dev`, getting the same error. After realizing that I need a specific version for opening my files, I discovered that a package I need was actually included in a Debian distribution, but it does not exist anymore under Ubuntu. I also tried to open the database using `bsddb3`'s `hashopen` function, but I suspect that the given format is not the one `bsddb3` is expecting:                 ...       File "./read_db.py", line 9, in open_db         f = db.hashopen(FILENAME)       File "/usr/lib/python2.7/dist-packages/bsddb3/__init__.py", line 347, in hashopen         d.open(file, db.DB_HASH, flags, mode)     bsddb3.db.DBInvalidArgError: (22, 'Invalid argument -- BDB0210 ././entries.db: metadata page checksum error')      The Ubuntu package `libdb1-compat` does contain tools that read from 1.85 format, but it does not contain any `db.h` header that I might use for compiling the python library `bsddb185`. How would you solve this problem? I am short on ideas right now.


title: How to get free memory on AIX?

text: How can I see the free memory on an AIX? There is no `free -m` under it. AIX oslevel: `6100-03-03-0943`


title: couldn't update git via git clone comand

text: I am just a beginner in Git. Was following through the documentation and installed Git using source code package. Now, after installing Git, I want to update it (Though it might be unnecessary at this time, I simply want to try and make sure it works). I ran the command `git clone git://git.kernel.org/pub/scm/git/git.git` and it returned error `-bash: /usr/bin/git: No such file or directory`. Reason might be obvious, since for installing git, I used the command `make prefix=/usr/local install` which installed Git in `/usr/local/bin/git` Now, how to fix this? I tried the same git clone command with `\--git-dir=/usr/local/bin/git` which returned the same error `-bash: /usr/bin/git: No such file or directory`


title: Installing a new OpenBSD kernel "safely": why does `make install` go through these extra hoops?

text: After building a new OpenBSD kernel, the `install` target of the kernel `Makefile` does the following:               rm -f /obsd     ln /bsd /obsd     cp bsd /nbsd     mv /nbsd /bsd      I understand that the first two lines remove the old backup kernel `/obsd` and create a hard link `/obsd` pointing to the currently running kernel `/bsd`. In particular, the running kernel is not moved at all. This makes sense to me. However, what is the purpose of moving the newly built kernel `./bsd` first to `/nbsd` and then renaming it to `/bsd`? Why not replace the third and fourth line by the apparently simpler `cp bsd /bsd`? If this should matter: the default partitioning scheme of OpenBSD places the kernel build tree in a different filesystem (disklabel) than the root filesystem.


title: What does running "< ./somefile.txt" in shell do?

text: So I just executed `< ./somefile.txt` in a shell, and it doesn't appear to do anything (the text file has valid linux commands). So where are the contents of the text file being redirected to? I'm just guessing null, but I am not sure. OS: Ubuntu 12.04


title: Kill a Process for a User

text: chomp $choice;     if ($choice == 5) {        print "**********************************\n";        print " Enter the User Name\n";        $user_name = <STDN>;             sub kill_processes {           $user_name = <STDN> ;           @process_list = `ps -u $user_name| awk ' { print $2 ;} ' `;           print @process_list;           print "Are you sure you want to kill all of these processes? (Y|N) >";           $resp = <STDIN> ;           chomp $resp;           if ( $resp eq "Y" || $resp eq 'y' ) {              foreach (@process_list) {                 if ( ! /PID/ ) {                    @process = split / /, $_;                    print "Killing Process $process[1]\n";                    `kill -09 $process[1]`;                 }              }           }        }                    }      This is only part of the code I can't get to work. Everything works fine when I select choice 5 but it doesn't do anything when I enter the user name? How can I get this this to work?


title: Logrotate no longer reads symlinked configuration file due to non-root ownership

text: We are currently upgrading from Ubuntu 12.04 LTS to 14.04 LTS on our ruby on rails application servers, and have noticed that the log files are no longer rotating. On both machines we have a file `/var/app-name/config/logrotate` owned by our unix user `deployer` which contains a valid logrotate file as follows:               /var/app-name/log/*.log {       daily       rotate 365       delaycompress       compress       dateext       dateformat -%Y%m%d       missingok       copytruncate     }      This is then symlinked into the `/etc/logrotate.d/` directory as `app-name` On our Ubuntu 12.04 server we have logrotate 3.7.8 which runs just fine. It goes into the `var/app-name/log/` directory and rotates all out log files But on Ubuntu 14.04 server we have logrotate 3.8.7 which doesn't rotate the logfiles for our application. When I debug this via `sudo logrotate -d -f /etc/logrotate/.conf` I get the following output:               Ignoring /etc/logrotate.d/app-name because the file owner is wrong (should be root).      Chasing this down in the code, it seems this change was added for the 3.8.x release stream: https://github.com/demands/logrotate/commit/b8ce386a969c60e5c8ee78023c24a1ba0aab1526 If I change the ownership of the file symlinked to `/var/app- name/config/logrotate` to `root` then it starts to work again. But given this file is part of my application, and created by the capistrano deployment framework we use in this state, I'd rather not have to alter it's ownership, when it used to work just fine. So are symlinked config files recommended / supported by logrotate ? And if so, should it's refusal to use my file (owned by `deployer`) which is symlinked into the `/etc/logrotate.d` directory, be seen as a bug ? Or is there another recommended approach for application-specific log rotation ? (also asked on superuser StackExchange)


title: Can not call a command

text: I have a script `/etc/init.d/tilestream` with:               TILESTREAM="/usr/bin/tilestream"     MAPPATH="/data"     HOST="host"     #HOST="localhost"     #UIPORT="9001"     UIPORT="8888"     #TILEPORT="9000"     TILEPORT="8888"     SUBDOMAINS="a,b,c,d"          case $1 in     start)         echo "Starting TileStream"        $TILESTREAM --tiles=$MAPPATH --host=$HOST --uiPort=$UIPORT --tilePort=$TILEPORT&         ;;      This works fine. But when I tried running it from the command line:               /usr/bin/tilestream --tiles=/data --host=host --uiPort=8888 --tilePort=8888      It didn't start; I couldn't see it in `top`. What can be wrong?


title: pipe line with non-deterministic output

text: I have happened upon a command that sometimes works and sometimes does not, even when executed multiple times in rapid succession in a `bash` shell (I have not tested the behavior in other shells). The problem has been localized to the reading of a variable in the `BEGIN` block of an `awk` statement at the end of the pipe line. During some executions, the variable is correctly read in the `BEGIN` block and during other executions, the operation fails. Supposing this aberrant behavior can be reproduced by others (and is not a consequence of some problem with my system), can its inconsistency be explained? Take as input the following file called `tmp`:               cat > tmp <<EOF     a   a     b   *     aa  a     aaa a     aa  a     a   a     c   *     aaa a     aaaa    a     d   *     aaa a     a   a     aaaaa   a     e   *     aaaa    a     aaa a     f   *     aa  a     a   a     g   *     EOF      On my system, the pipe line                awk '{if($2!~/\*/) print $1}' tmp | tee >(wc -l | awk '{print $1}' > n.txt) | sort | uniq -c | sort -k 1,1nr | awk 'BEGIN{getline n < "n.txt"}{print $1 "\t" $1/n*100 "\t" $2}'      will either produce the correct output:               4   28.5714 a     4   28.5714 aaa     3   21.4286 aa     2   14.2857 aaaa     1   7.14286 aaaaa      or the error message:               awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted      How can a command _possibly_ give different output when run twice in succession when no random number generation is involved and no change to the environment is made in the interim? To demonstrate how absurd the behavior is, consider the output generated by executing the above pipe line ten times consecutively in a loop:               for x in {1..10}; do echo "Iteration ${x}"; awk '{if($2!~/\*/) print $1}' tmp | tee >(wc -l | awk '{print $1}' > n.txt) | sort | uniq -c | sort -k 1,1nr | awk 'BEGIN{getline n < "n.txt"}{print $1 "\t" $1/n*100 "\t" $2}'; done     Iteration 1     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted     Iteration 2     4   28.5714 a     4   28.5714 aaa     3   21.4286 aa     2   14.2857 aaaa     1   7.14286 aaaaa     Iteration 3     4   28.5714 a     4   28.5714 aaa     3   21.4286 aa     2   14.2857 aaaa     1   7.14286 aaaaa     Iteration 4     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted     Iteration 5     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted     Iteration 6     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted     Iteration 7     4   28.5714 a     4   28.5714 aaa     3   21.4286 aa     2   14.2857 aaaa     1   7.14286 aaaaa     Iteration 8     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted     Iteration 9     4   28.5714 a     4   28.5714 aaa     3   21.4286 aa     2   14.2857 aaaa     1   7.14286 aaaaa     Iteration 10     awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted      Note: I have also tried closing the file (awk `close`) after reading the variable, in case the problem relates to the file being left open. However, the inconsistent output remains.


title: Summing up an array inside of awk?

text: I have the following piece of code:               sum1=     sum2=         declare -a a     echo $temp | awk '{split($0,a,","); name=a[1] ; for(i=2;i<=4;i++) sum1+=a[i] ; for(i=5;i<=7;i++) sum2+=a[i] }'      This code is not working. Here temp is a string of type:               abc,1,2,3,4,5,6      I am beginner and need some suggestions. Actually I am parsing data from a file. The input file is like:               abc,1,2,3,4,5,6     de,3,5,7,8,4,2     xyz,6,5,3,7,8,2      I am reading it using               while  read temp     do      #do something     done < sample.csv      And expected output is of the form:               Name   Sum1  Sum2     abc      6    15     de      15    14     xyz     14    17


title: Is there a downside to deleting all of the broken symbolic links in a system?

text: I was running a script that iterated over all the files on my Linux system and created some metadata about them, and it threw an error when it hit a broken symbolic link. I am newish to *nix, but I get the main idea behind linking files and how broken links come to exist. As far as I know, they are like the equivalent of litter in the street. Things that a program I'm removing wasn't smart enough to tell the package manager existed, and belonged to it, or something that got left behind in an upgrade. At first, I started to tweak the script I'm running to skip them, then I thought, 'well we could always delete them while we're down here...' I'm running Ubuntu 14.04 (Trusty Tahr). I can't see any reason not to, but before I go ahead and run this over my development system, is there any reason this might actually be a terrible idea? Do broken symlinks serve some purpose I am not aware of?


title: Cannot access HDD files through Linux Mint Live USB

text: I have valuable info on my Ubuntu partition, but it crashed, and I tried to get to it through Live USB with Mint 14, but it says it's read only. Can I make it writable too? So I can put it on my flash drive?


title: kill a group of processes with negative PID

text: kill -TERM -PID       is supposed to kill PID and all its child processes.   but this doesn't work on openSUSE, it always tell me that no such process -PID no matter what PID i use.   So if the negative PID option is not supported by this particular version of kill, what is the best way to kill a group of processes? background:   I have a shell script running. inside the script, I use wget to download things. So the script is the parent process, wget is the child process. I want to kill them both using kill -TERM -PID_OF_SCRIPT


title: starting server with nohup and redirecting input, output

text: I have a init.d script that starts a python socket server. Because I want this to run as a daemon, I use nohup to start it. I also want to redirect stdout and stderr to a log file. My problem is that I am also trying to capture the PID of the process to save to a file, which I can't seem to do.               # Start server     echo "Starting server."     nohup ${PROGDIR}/${PROGNAME} -l $IPADDR >>${LOGDIR}/${OUTLOG} 2>>${LOGDIR}/${OUTLOG} </dev/null &     PID=$!      This was able to capture the PID, but redirection did not work. (Was I redirecting nohup rather than the program?) Next I tried something like:               nohup /bin/bash -c '...'      But I lost the PID. At this point, I seemed to be getting the PID of `nohup /bin/bash -c`. As I am not very familiar with shell scripts, I thought I would ask for help before I shoot myself in the foot. So my question is, how can I capture the PID and redirect the server output to the logfile? I am on a debian (raspberry pi) and am writing an init script using rc-update.d.


title: Using Ctrl+[0-9] to cycle between windows using tmux

text: I have started using `tmux` but I feel that using `Ctrl``b``0-9` is very annoying, because it's used so often. How do I bind the keyboard so I only need to do `Ctrl``0-9` for changing windows (like in Chrome)? I have tried to configure it in the `.tmux.conf`, but without any success. this is my current .tmux.conf file               bind C select-pane -t :.+     set -g status-bg black     set -g status-fg white


title: Using a differencing, aka overlay, aka union, file-system with commit capability

text: I work in two PCs and I sync all my files from my primary PC to a USB flash memory. In my second PC, I mount the USB flash memory to the same path to work on my files as I were on my primary PC. Now for the sake of performance and flash memory lifetime, I need to use any type of differencing, aka overlay, aka union, file-system (like unionfs or aufs) to let me use the USB flash disk as read-only and write changes to a temp directory and at the end allows me to write the changes back to the USB flash at once. Any help? Any hope? **Update:** Thanks for all your answers and comments. I am interested in Linux and my question is: **Does any of the above file-systems allow committing the writes to the lower file-systems when required? If yes, how?**


title: Commandline tool for comprehensive and integrated testing of internet connectivity

text: Is there a commandline tool for GNU/Linux which will analyse download and upload speed, packet-loss, latency and other factors which will indicate internet connectivity status?


title: Does fetchmail support these IMAP features? If so, how?

text: I'm studying and learning about how mail is handled in linux systems, and one thing has become a source of confusion for me. On my iPhone, via IMAP, I can mark a message in my Gmail inbox as read, or I can move it to another folder ("label" in Gmail speak). Then when I later view my Gmail account via web interface, these changes have percolated to the Gmail server. However, given my linux client, I have read that all fetchmail does is fetch mail (pun unintended), rather than deliver it. The delivery part would be the responsibility of procmail or postfix. But if fetchmail just hands off the delivery part to procmail or postfix, it doesn't seem like it would have any way of knowing whether that email was later marked as read or saved to a specific IMAP folder. In fact, it seems like the idea of an "IMAP folder" wouldn't even seem to exist any longer at that point! Does fetchmail actually do some creation or marking of "IMAP folders"? So is it possible to use fetchmail to get local copies of mail from the server, yet still keep the IMAP features of marking messages as read and moving them to specific folders? If so, how?


title: Arch linux booting into rescue shell by default

text: I just installed Arch in my PC alongside windows 7 but for some reason it boots directly into the rescue shell, this is how it looks It doesn't show any errors though, and if I press Ctrl+D it just shows me my display manager like normal, how can I make it so it boots directly into the display manager? Thanks in advance.


title: Shutdown from login prompt in tty

text: Suppose I boot a Linux machine without GUI. When it displays a tty login prompt, can I shutdown the machine with a keyboard sequence? Of course I could type in my username and password and then `sudo shutdown -h now`; however, is it possible to shut it down before the login using a keyboard shortcut?


title: Validate AIX Password for root from script

text: Looking for a way in a shell script to validate the password for for root on an (AIX) matches a standardized plain text password. This query is similar to another one on this site. I have access to root and can compile a c Program if needed. I have been abel to find standard libraries to do this for HP-UX and Linux. Now I am working on AIX and I have been hitting nothing but road blocks. I have been able to extract the salt and the hash and I know the plain text password. I am wanting to input the salt and password and get back the password hash so the I can compare it to what is stored on the server.


title: mutt: mark as read and delete

text: I discard some messages without reading them. After deleting said messages, however, I am soon alerted to the presence of unread mail in my trash can. Is there a way to either:   * disable the alert (`set beep_new`) when a new message is found in the trash can; or   * simultaneously mark a message as read and delete it? I imagine the former could be implemented with a trash folder hook and the latter could be implemented using a macro. However, in the case of the latter, after marking a message (`Wn`) or entire thread (`^R`) as read, the selected entry may or may not change, depending on the position of the message in the folder. One must then use a conditional to determine how to restore the selection by use of the entry navigation commands. After restoring the selection, the message can be deleted. According to the official documentation, the configuration files do not support conditionals, so a macro-based solution might involve piping through a shell script. Perhaps there is a simpler solution to this problem that I have overlooked?


title: Debian 6 VM server - network connectivity problem

text: I'm having a problem with a Debian 6 VM server where it looses network connectivity and doesn't come back (server does not respond to pings, and can't connect to any services). This is a wired network connection in a data center where the network is up when the problem occurs. When logged into the console, I confirm that the server doesn't seem to have network conectivity (can't ping ip 8.8.8.8 for example). All services are running though (mysql, Apache, SSH, etc). There are some errors in /var/log/kern.log, but not sure these are related to the problem:               Jan  5 01:43:41 vm2 kernel: [12179513.252191] INFO: task mysqld:1369 blocked for more than 120 seconds.     Jan  5 01:43:41 vm2 kernel: [12179513.253230] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     Jan  5 01:43:41 vm2 kernel: [12179513.254237] mysqld        D ffff8801b46de9f0     0  1369   1179 0x00000000     Jan  5 01:43:41 vm2 kernel: [12179513.254243]  ffff8801b46de9f0 0000000000000286 ffff8801fd105e18 000000010000000e     Jan  5 01:43:41 vm2 kernel: [12179513.254250]  ffff8801f750f478 ffff8801fd105e18 000000000000f9e0 ffff8801fd105fd8     Jan  5 01:43:41 vm2 kernel: [12179513.254253]  00000000000157c0 00000000000157c0 ffff8801fd1c5bd0 ffff8801fd1c5ec8     Jan  5 01:43:41 vm2 kernel: [12179513.254259] Call Trace:     Jan  5 01:43:41 vm2 kernel: [12179513.254270]  [<ffffffff810b61e1>] ? wait_on_page_writeback_range+0xce/0x11b     Jan  5 01:43:41 vm2 kernel: [12179513.254282]  [<ffffffffa001fe20>] ? log_wait_commit+0xbf/0x112 [jbd]     Jan  5 01:43:41 vm2 kernel: [12179513.254288]  [<ffffffff81066332>] ? autoremove_wake_function+0x0/0x2e     Jan  5 01:43:41 vm2 kernel: [12179513.254296]  [<ffffffff8130f142>] ? _spin_unlock_irqrestore+0xd/0xe     Jan  5 01:43:41 vm2 kernel: [12179513.254303]  [<ffffffffa00303f8>] ? ext3_sync_file+0x94/0xc8 [ext3]     Jan  5 01:43:41 vm2 kernel: [12179513.254309]  [<ffffffff8110d6e0>] ? vfs_fsync_range+0x73/0x9e     Jan  5 01:43:41 vm2 kernel: [12179513.254312]  [<ffffffff8110d78a>] ? do_fsync+0x28/0x39     Jan  5 01:43:41 vm2 kernel: [12179513.254316]  [<ffffffff8110d7b9>] ? sys_fsync+0xb/0x10     Jan  5 01:43:41 vm2 kernel: [12179513.254319]  [<ffffffff8130f6fa>] ? error_exit+0x2a/0x60     Jan  5 01:43:41 vm2 kernel: [12179513.254323]  [<ffffffff81011b42>] ? system_call_fastpath+0x16/0x1b       When the problem happens, the network interfaces are up (I checked ifconfig, all interfaces looked normal). I also check iptables, and verify there were no rules that would block anything. I also try running /etc/init.d/networking/restart, but that does not fix the problem. The only thing I've found that fixes the problem is rebooting. Hoping for some advice on things I can check to help troubleshoot this problem.


title: What distributions work out of the box with tablet computers?

text: I recently got my hands on a tablet computer. I tend to at least dual boot my systems. While doing some research about tablet computing and *nix most of the information was from the 2004-2008 era light years ago in computing time. What is the current state of tablet computing? I want something that works out of the box with minimal fuss - I'm way past the point that futzing with things is worth the time I spend on it. Specifically I'm looking to have features comparable to windows 7 + office:   * Virtual Keyboard - selectable handwriting / touch keyboard   * OneNote replacement   * Navigation via pen What distribution out there has really good tablet support of the box in 2010? (also bonus points for fun tablet apps in linux)


How to pause listing long text file with cat in command prompt after 10lines then press any key. for example:               cat myfiles.txt          bla     bla     bla     bla     bla     bla     .     .     .     bla     press enter to continue


title: Can Linux support Mirror Bootable Disk with LVM like IBM-AIX/HP/Solaris UNIX?

text: I have searched a lot in Google and Linux sites, but it seems that only UNIX, especially HP-UX supports mirror bootable disk configuration. Can anyone tell me whether Linux (I am using SuSE 10) can support this or not, and how to if can? I have found one shell scripts of HP-UNIX config about this, please see here


title: Sending music directly from MIC to LS

text: How can I tell linux to send directly from my microphone to my loudspeaker?


title: Debian server on a Intel Core i3 and Intel Q57 Chipset - will it work?

text: I want to build a Debian server (running samba, postfix, apache - without X11) on a Intel Core i3 / Intel Q57 Chipset system. I'm relativly new to the Linux- World but had driver issues already within my desktop (ATI GPU) that I wasn't able to solve. Will the following components work fine with Debian Linux?   * Intel Core i3-530 2x2.93GHz 4MB VideoHD Sock1156 (Clarkdale) BOX   * Gigabyte GA-Q57M-S2H GL/SATA/R/DVI/HDMI/DP Q57 HD Graphics mATX Sock1156   * Raid: Samsung SpinPoint F3 HD502HJ - 500GB 7200rpm 16MB 3.5zoll SATA300


title: Heartbeat 3 binding socket error

text: I've been tying to install Heartbeat3.0.5+Pacemaker1.0.12 on CentOS 6.3 64bit via yum. The installation seems to be successful, but there is a problem when starting Heartbeat. I put some info related to this issue below. Node Info               Active  : hm5     Standby : hm6      Package Info               [root@hm5 rpm]# rpm -qa | grep -i heartbeat     heartbeat-libs-3.0.5-1.1.el6.x86_64     heartbeat-3.0.5-1.1.el6.x86_64          [root@hm5 rpm]# rpm -qa | grep -i pacemaker     pacemaker-1.0.11-1.2.el6.x86_64     pacemaker-libs-1.0.11-1.2.el6.x86_64      ha.cf Info               [root@hm5 rpm]# cat /etc/ha.d/ha.cf      pacemaker on     logfacility local1          debug 1     udpport 694          keepalive 2     warntime 20     deadtime 24     initdead 48          bcast eth1          node hm5     node hm6     watchdog /dev/watchdog      Interface Info               [hm5]     eth0      Link encap:Ethernet  HWaddr 54:52:00:18:DE:97                 inet addr:192.168.122.35  Bcast:192.168.122.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1791 errors:0 dropped:0 overruns:0 frame:0               TX packets:361 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:121033 (118.1 KiB)  TX bytes:58678 (57.3 KiB)          eth1      Link encap:Ethernet  HWaddr 54:52:00:6F:E3:74                 inet addr:192.168.123.5  Bcast:192.168.123.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1238 errors:0 dropped:0 overruns:0 frame:0               TX packets:3 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:68171 (66.5 KiB)  TX bytes:126 (126.0 b)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)          [hm6]     [root@hm6 ~]# ifconfig -a     eth0      Link encap:Ethernet  HWaddr 54:52:00:40:7D:BE                 inet addr:192.168.122.36  Bcast:192.168.122.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1345 errors:0 dropped:0 overruns:0 frame:0               TX packets:49 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:77115 (75.3 KiB)  TX bytes:6223 (6.0 KiB)          eth1      Link encap:Ethernet  HWaddr 54:52:00:72:DB:F1                 inet addr:192.168.123.6  Bcast:192.168.123.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1286 errors:0 dropped:0 overruns:0 frame:0               TX packets:3 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:70729 (69.0 KiB)  TX bytes:126 (126.0 b)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)      Error Log After Starting Heartbeat by Root User               Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(udpport,694)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(keepalive,2)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(warntime,20)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(deadtime,24)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(initdead,48)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(bcast,eth1)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(node,hm5)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(node,hm6)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(watchdog,/dev/watchdog)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: uid+hacluster, gid+<null>     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: uid+hacluster, gid+<null>     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: uid+<null>, gid+haclient     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: uid+root, gid+<null>     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: uid+<null>, gid+haclient     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Beginning authentication parsing     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: 16 max authentication methods     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Keyfile opened     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Keyfile perms OK     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: 16 max authentication methods     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Found authentication method [sha1]     Jul 30 19:12:52 hm5 heartbeat: [1448]: info: AUTH: i+1: key + 0x215bf40, auth+0x7fdb7ac89db0, authname+sha1     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Outbound signing method is 1     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Authentication parsing complete [1]     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(cluster,linux-ha)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(hopfudge,1)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(baud,19200)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(auto_failback,legacy)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(hbgenmethod,file)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(realtime,true)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(msgfmt,classic)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(conn_logd_time,60)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(log_badpack,true)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(syslogmsgfmt,true)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(coredumps,true)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(autojoin,none)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(uuidfrom,file)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(compression,zlib)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(compression_threshold,2)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(traditional_compression,no)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(max_rexmit_delay,250)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: Setting max_rexmit_delay to 250 ms     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(record_config_changes,on)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(record_pengine_inputs,on)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(enable_config_writes,on)     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: add_option(memreserve,6500)     Jul 30 19:12:52 hm5 heartbeat: [1448]: WARN: Logging daemon is disabled --enabling logging daemon is recommended     Jul 30 19:12:52 hm5 heartbeat: [1448]: info: **************************     Jul 30 19:12:52 hm5 heartbeat: [1448]: info: Configuration validated. Starting heartbeat 3.0.5     Jul 30 19:12:52 hm5 heartbeat: [1448]: debug: HA configuration OK.  Heartbeat starting.     Jul 30 19:12:52 hm5 heartbeat: [1448]: info: Heartbeat Hg Version: node: 7e3a82377fa8c88b4d9ee47e29020d4531f4629a     Jul 30 19:12:52 hm5 heartbeat: [1449]: info: heartbeat: version 3.0.5     Jul 30 19:12:52 hm5 heartbeat: [1449]: info: Heartbeat generation: 1343634035     Jul 30 19:12:52 hm5 heartbeat: [1449]: debug: uuid is:8724b422-87c2-4056-9433-7be507f2efb3     Jul 30 19:12:52 hm5 heartbeat: [1449]: debug: FIFO process pid: 1452     Jul 30 19:12:52 hm5 heartbeat: [1449]: debug: opening bcast eth1 (UDP/IP broadcast)     Jul 30 19:12:52 hm5 heartbeat: [1449]: debug: glib: SO_BINDTODEVICE(r) set for device eth1     Jul 30 19:12:52 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:52 hm5 heartbeat: [1452]: debug: pid 1452 locked in memory.     Jul 30 19:12:52 hm5 heartbeat: [1452]: debug: Limiting CPU: 6 CPU seconds every 60000 milliseconds     Jul 30 19:12:53 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:54 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:55 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:56 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:57 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:58 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:12:59 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:13:00 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:13:01 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:13:02 hm5 heartbeat: [1449]: ERROR: glib: Unable to bind socket (Permission denied). Giving up.     Jul 30 19:13:02 hm5 heartbeat: [1449]: info: glib: UDP Broadcast heartbeat closed on port 694 interface eth1 - Status: 1     Jul 30 19:13:02 hm5 heartbeat: [1449]: ERROR: make_io_childpair: cannot open bcast eth1     Jul 30 19:13:02 hm5 heartbeat: [1449]: debug: Exiting from pid 1449 [rc+4]     Jul 30 19:13:03 hm5 heartbeat: [1452]: CRIT: Emergency Shutdown: Master Control process died.     Jul 30 19:13:03 hm5 heartbeat: [1452]: CRIT: Killing pid 1449 with SIGTERM     Jul 30 19:13:03 hm5 heartbeat: [1452]: CRIT: Emergency Shutdown(MCP dead): Killing ourselves.     Jul 30 19:13:03 hm5 heartbeat: [1452]: debug: Process 1452 processing SIGTERM     Jul 30 19:13:03 hm5 heartbeat: [1452]: debug: Exiting from pid 1452 [rc+15]      The main problem seems to be related to               Jul 30 19:13:01 hm5 heartbeat: [1449]: ERROR: glib: Error binding socket (Permission denied). Retrying.     Jul 30 19:13:02 hm5 heartbeat: [1449]: info: glib: UDP Broadcast heartbeat closed on port 694 interface eth1 - Status: 1      But I haven't found the precise cause of this yet, I really do need help.


title: gnome-dictionary no-window option does not work

text: I would like to have a bash dictionary so I found `gnome-dictionary`. However, just typing `gnome-dictionary` will bring up a GUI box. In `gnome-dictionary --help`, and in the man file, it says a `-n` or `\--no-window` flag will disable the GUI popup and print the result on stdout. But this does not work. Instead, it says you should see the help for whatever cool things to do. The man page refers to gnome-utils 2.13.4. **Edit** Some "extra material" to the accepted answer.               # for `.bz2`; for `.gz`, drop `j` for `z`     # create (`sudo mkdir -p ...`) path if not there     add-dict () {       sudo tar -xvjf $1 -C /usr/share/stardict/dic     }          alias sd="sdcv"          wd () {       sdcv $1 | /usr/bin/fold --spaces --width=73     }


title: How can I send stdout to multiple commands?

text: There are some commands which filter or act on input, and then pass it along as output, I think usually to `stdout` - but some commands will just take the `stdin` and do whatever they do with it, and output nothing. I'm most familiar with OS X and so there are two that come to mind immediately are `pbcopy` and `pbpaste`- which are means of accessing the system clipboard. Anyhow, I know that if I want to take stdout and spit the output to go to both `stdout` and a file then I can use the `tee` command. And I know a little about `xargs`, but I don't think that's what I'm looking for. I want to know how I can split `stdout` to go between two (or more) commands. For example:               cat file.txt | stdout-split -c1 pbcopy -c2 grep -i errors      There is probably a better example than that one, but I really am interested in knowing how I can send stdout to a command that does not relay it and while keeping `stdout` from being "muted" - I'm not asking about how to `cat` a file and `grep` part of it and copy it to the clipboard - the specific commands are not that important. Also - I'm not asking how to send this to a file and `stdout` - this may be a "duplicate" question (sorry) but I did some looking and could only find similar ones that were asking about how to split between stdout and a file - and the answers to those questions seemed to be `tee`, which I don't think will work for me. Finally, you may ask "why not just make pbcopy the last thing in the pipe chain?" and my response is 1) what if I want to use it and still see the output in the console? 2) what if I want to use two commands which do not output `stdout` after they process the input? Oh, and one more thing - I realize I could use `tee` and a named pipe (`mkfifo`) but I was hoping for a way this could be done inline, concisely, without a prior setup :)


title: Is it possible to obtain the current name of the xterm window?

text: This LDP Howto demonstrates how to change the title of an xterm. I know that this is also possible using the `xtitle` command. Before invoking a long-running action, my script uses such techniques to change the title of its xterm window. I would like to extract the name of the xterm window prior to changing it so that, once the long-running action is completed, I can restore the title to its previous value. It would sort of be an inverse to xtitle... Is this even possible?


title: Installing Grub 2 on a USB flash drive

text: MultiBootISOs is a tool that let you install Grub on a USB flash drive. I really like it because it lets me boot from ISO files and let me put a bunch of ISOs on my USB and choose which one to boot. The problem is, this is a Windows tool, and I don't know how to do it through the command lines. I would also like to know how to install Grub (2) this way, Grub Legacy seems to be easier... EDIT: I'm not asking for a tool (and definitely not a Windows tool). I want to know the commands that I have to execute to have the same effects. I'm having Ubuntu in my mind right now, but if there is a general way that I can boot any ISO in the USB then that would be better.


title: problem dhcp3-server ubuntu server 11.04

text: I installed dhcp3-server in ubuntu server 11.04               apt-get install dhcp3-server      However, an error message during installation:               Traitement des actions différées (« triggers ») pour « man-db »...     Traitement des actions différées (« triggers ») pour « ureadahead »...     Paramétrage de isc-dhcp-server (4.1.1-P1-15ubuntu9.1) ...     Generating /etc/default/isc-dhcp-server...     * Starting ISC DHCP server dhcpd                                                * check syslog for diagnostics                                   [fail]     invoke-rc.d: initscript isc-dhcp-server, action "start" failed.     Paramétrage de dhcp3-server (4.1.1-P1-15ubuntu9.1) ...      * * * `tail -f /var/log/syslog` says:               Sep  2 03:29:20 srv dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1     Sep  2 03:29:20 srv dhcpd: Copyright 2004-2010 Internet Systems Consortium.     Sep  2 03:29:20 srv dhcpd: All rights reserved.     Sep  2 03:29:20 srv dhcpd: For info, please visit https://www.isc.org/software/dhcp/     Sep  2 03:29:20 srv dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1     Sep  2 03:29:20 srv dhcpd: Copyright 2004-2010 Internet Systems Consortium.     Sep  2 03:29:20 srv dhcpd: All rights reserved.     Sep  2 03:29:20 srv dhcpd: For info, please visit https://www.isc.org/software/dhcp/     Sep  2 03:29:20 srv dhcpd: Wrote 0 leases to leases file.     Sep  2 03:29:20 srv dhcpd:      Sep  2 03:29:20 srv dhcpd: No subnet declaration for eth0 (192.168.1.1).     Sep  2 03:29:20 srv dhcpd: ** Ignoring requests on eth0.  If this is not what     Sep  2 03:29:20 srv dhcpd:    you want, please write a subnet declaration     Sep  2 03:29:20 srv dhcpd:    in your dhcpd.conf file for the network segment     Sep  2 03:29:20 srv dhcpd:    to which interface eth0 is attached. **     Sep  2 03:29:20 srv dhcpd:      Sep  2 03:29:20 srv dhcpd:      Sep  2 03:29:20 srv dhcpd: Not configured to listen on any interfaces!     Sep  2 03:29:23 srv kernel: [ 1625.286737] type=1400 audit(1314930563.298:18)            apparmor="STATUS" operation="profile_replace" name="/usr/sbin/dhcpd" pid=2045     comm="apparmor_parser"      when I try to access the file `/etc/dhcp3/dhcpd.conf` I can not find it. the package `dhcp-server` is installed.               root@srv:/etc/dhcp3#ls -l     total 4 drwxr-xr-x 2 root root 4096 2011-09-01 06:42 dhclient-enter-hooks.d


title: How do I change file associations from the command line?

text: The system in question is Solaris, using the Gnome type interface (Java Desktop Environment). We have occasional issues with users managing to mess up their file assocations (most notably .tif). Trying to find out what files to edit from a command line to change those file associations. (as logging in graphically as them to use the desktop utilities can be a bit of a problem remotely).


title: Where can I find a download of Darwin from Apple?

text: Where can I find a ISO download of Darwin? I downloaded Darwin at one time (even after they stopped releasing the ISOs) off of Apple's website. Unfortunately, I have no idea where the link went. I had it at one time.


title: User logged in by sftp does not show up in `w`

text: My server is Centos 5. I have a chroot environment set up with the following in my sshd_config               Match group sftponly         ForceCommand internal-sftp         ChrootDirectory %h         AllowTcpForwarding no         PasswordAuthentication yes     Match      When a user connects by sftp, a line is added to /var/log/secure:               Sep  3 15:30:20 servername sshd[26548]: pam_unix(sshd:session): session opened for user test by (uid=0)      However they are not present when executing `w`:               [root@servername home]# w      15:30:47 up 156 days,  1:00,  3 users,  load average: 0.05, 0.18, 0.32     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT     mike     pts/1    12.34.56.78      Fri16    0.00s  0.10s  0.03s sshd: mike [priv]      But when users connect by SSH (like the user above), they are present. Is this standard behavior?


title: Debian - install missing man pages?

text: I run RaspBMC - a distro based on Raspbian, that's a custom minimal Debian for the Raspberry Pi. If I recall correctly, the `man` utility is NOT installed by default with RaspBMC (although I may be mistaken). The problem is, packages installed prior to installing the actual `man` utility do not install their man pages. This includes the packages that come pre-installed with the system. Example: I tried with udisks-glue (which comes pre-installed)               $ man udisks-glue     No manual entry for udisks-glue      After re-installing that package, the man page is there.               $ apt-get remove udisks-glue     $ apt-get install udisks-glue     $ man udisks-glue     [Man page gets displayed]      **The question is: can I somehow install _all_ the missing man pages easily?** From what I can see, installing the man pages is a step that's run for each `apt-get install` command:               Unpacking udisks-glue (from .../udisks-glue_1.3.4-1_armhf.deb) ...     Processing triggers for man-db ...     [...]      Using divide-and-conquer, I assume this could be obtained by:   1. getting a list of all installed packages ( `dpkg -l | grep ??? | cut ??? | ???` )   2. finding a way to tell apt-get to re-install a package without messing with the config (a `remove + install` kinda fits the bill, but I don't think it plays nice with dependencies)   EDIT: this should do it:   `sudo apt-get install --reinstall packagename`   3. run 2. over each item in 1. Is this the (simplest) way to go? **Update** I remembered I bricked RaspBMC once doing `apt-get upgrade`, so I want to make sure the packages are NOT upgraded to newer versions when reinstalling (which seems to be the case with `apt-get install --reinstall` by default.


title: Executing user defined function in a find -exec call

text: I'm on Solaris 10 and I have tested the following with ksh (88), bash (3.00) and zsh (4.2.1). The following code doesn't yield any result:               function foo {         echo "Hello World"     }          find somedir -exec foo \;      The find does match several files (as shown by replacing `-exec ...` with `-print`), and the function works perfectly when called outside from the `find` call. Here's what the `man find` page say about `-exec`:                -exec command       True if the executed command  returns  a                          zero  value  as  exit status. The end of                          command must be punctuated by an escaped                          semicolon (;).  A command argument {} is                          replaced by the current pathname. If the                          last  argument  to  -exec  is {} and you                          specify + rather than the semicolon (;),                          the command is invoked fewer times, with                          {} replaced by groups of  pathnames.  If                          any  invocation of the command returns a                          non-zero  value  as  exit  status,  find                          returns a non-zero exit status.      I could probably get away doing something like this:               for f in $(find somedir); do         foo     done      But I'm afraid of dealing with field separator issues. Is it possible to call a shell function (defined in the same script, let's not bother with scoping issues) from a `find ... -exec ...` call? I tried it with both `/usr/bin/find` and `/bin/find` and got the same result.


title: Name Lookup takes a long time

text: I was using a script that uses curl. Quite often curl fail. The error is name lookup timed out I tried to ping google.com and and other sites. Indeed dns (or whatever do the translation from domain name to IP takes a few seconds to do that. How to make my dns server (/resolver, or what is it anyway) work faster? How to test this without a program? How to test dns resolution time?


title: Install Ghostscript v 9.05 (or newer) on CentOS

text: I need to use the **ghostscript inkcov device** on my **CentOS** server. The device is said to be available on GS versions **9.05 and newer**. However, `yum install ghostscript` installs version **8.70**. **What is the easiest way to get the inkcov device to work?**


title: How to test DNS speed?

text: I am using google open DNS now. I want to test it's speed. How can I? I can ping and see that it gets faster. I need some faster way.


title: Solaris ptree style tool for Linux

text: I'm looking for the Linux tool that will print the same output as the Solaris ptree. For example:               # ptree 538     538   /usr/lib/ssh/sshd       889   /usr/lib/ssh/sshd         890   /usr/lib/ssh/sshd           1498  -sh             1649  bash               1656  -sh                 1660  bash                   13716 ptree 538      I'm aware that pstree exists, but I don't like its output format. Does anyone know any similar tools?


title: Cannot login to KDE

text: Last time I booted and logged into my Kubuntu account, I was surprised not to end up on my desktop but in XBMC, which I already installed some months ago. I repeated this several times with the same result. I was able to switch to a virtual terminal, where I uninstalled xbmc, but this did not help. After I enter my login data, I end up seeing nothing but the background of my login screen and my mouse cursor. What can I do? I am completely stuck...


title: Dump process's stdin and stdout

text: I have two processes, let's say Parent and Child. Parent launches the Child and communicates with it through child's stdin and stdout.               Parent <-> Child      These processes use text protocol and I need to investigate it. I would like to create a bash script which will be launched by the Parent instead of child. This script will launch the Child and in addition will dump stdin and stdout streams to a log files.               Parent <-> MyProcess <-> Child                 |                 v               log.txt      Is there a way in bash to do what I need or do I need to use C?


title: X goes black when using SimpleScreenRecorder

text: When using `SimpleScreenRecorder`, `X` goes black all the time when I do anything more trivial than typing in a terminal session. I have to switch to another `tty` and back to `X` for it to show again. Does someone know a fix for this, or at least what is causing it? EDIT: System info               Linux localhost 3.12.9-1-t520 #1 SMP PREEMPT Fri Jan 31 14:38:45 CET 2014 x86_64 GNU/Linux     X.Org X Server 1.15.0     i3 version 4.7.2     SimpleScreenRecorder 0.1.2


title: Cannot rotate screen with xrandr

text: OS: Linux Mint The output of `inxi -xG`:               Graphics:  Card: NVIDIA GF108 [GeForce GT 440] bus-ID: 02:00.0                X.Org: 1.13.0 drivers: vesa (unloaded: fbdev) Resolution:      800x600@0.0hz               GLX Renderer: Gallium 0.4 on llvmpipe (LLVM 3.3, 128 bits) GLX     Version: 2.1 Mesa 9.2.0 Direct Rendering: Yes      Intend to flip the PC's screen. Above information about current graphics card and operating system.               $ xrandr     xrandr: Failed to get size of gamma for output default     Screen 0: minimum 320 x 400, current 800 x 600, maximum 800 x 600     default connected 800x600+0+0 0mm x 0mm       800x600         0.0*        640x480        60.0         640x400         0.0         320x400         0.0       So far, I've tried to follow the available tips on the internet, unsuccessfully. My main suspicion is about the Nvidia driver. Can anyone shed light over this issue? This command: `xrandr -o rotate` doesn't work.


title: Mutt: select multiple messages

text: I am looking for a way to select multiple messages in Mutt. For example select the first and the last message would select a whole block of messages. Possible also to select by regexp for subject. I want then run a command on the selected messages, i.e. save them to a file.


title: setenv not working in tcsh

text: I am trying to install a program on my brand-new CentOs. The installation requires `setenv`, which apparently does not work, not even in the tcsh shell. Can anyone give me some advice?               [Anna@anna xd-demo] ./setup.csh          Configuring shell for the XD2006 :     ./setup.csh: line 7: setenv: command not found     ./setup.csh: line 8: setenv: command not found     ./setup.csh: line 9: setenv: command not found     ./setup.csh: line 10: setenv: command not found     ./setup.csh: line 11: syntax error near unexpected token `('     ./setup.csh: line 11: `set path=( $XD_ROOT/bin $XD_ROOT/lib/xd $XD_ROOT/lib/xdgraph $path )'     [Anna@anna xd-demo]$ echo $shell     /bin/tcsh


title: How to format a CF card by a terminal command?

text: I want to know the command for formatting a compact flash card from the terminal.


title: Linux kernel dropping custom keyboard scan codes

text: I have a vintage IBM 122 key model M keyboard that I am adapting for use on a modern computer. I am using a Teensy 2.0 to do the encoding and to handle the USB side of things. I borrowed the firmware from the Humble Hacker keyboard project (https://github.com/humblehacker/keyboard) and I added the extra keys in the build config. So far, so good. All of the "regular" keys work, but the kernel appears to be dropping the extra keys (`F13`-`F24`, etc.). Running `/lib/udev/keymap -i input/event0` shows the scan codes of all the normal keys, but nothing for the extra keys. Running `wireshark` to packet capture the USB port shows that the **keyboard IS sending** the scan codes, but it looks like the kernel is just dropping them on principle. I feel like this is something in the kernel drivers that is simply not delivering scan codes that it does not expect. I would think that there would be some sort of "master" key map in some `.h` file in the kernel source somewhere, but so far, I have not been successful in my efforts to find it. It is worth stressing that I am not asking about mapping the extra keys in X, like so many others before me. This is a low level, apparently kernel related, problem. Assume for the moment that I will not be using X at all. What I need is for the scan codes to show up when I run `/lib/udev/keymap -i`, I can do the rest from there.


title: Zsh theme guides

text: Does anyone know any good tutorials (or books) for what goes into writing a theme?


title: Pipe not picking up stdout

text: I am running a java program from a `OS X 10.8` bash terminal, and are trying to rederect the output it is producing. However, when either running this throug a pipe, or rederecting it to a file, the output is blank, however I see the output in the terminal. To illustrate this:               > java program.java     13/10/02 14:18:30 WARN some     13/10/02 14:18:30 INFO log     13/10/02 14:18:30 INFO messages     ...          > java program.java > log     > cat log     >      Can the java program be set up so that it is writing to another stream than `stdout`, but a stream that still produces output in the terminal. Is such a thing possible?


title: RHEL OS not visible anymore after installation of windows

text: I had a RHEL system with `/ - 40 GB`, `/boot - 100 MB` and `/swap - 2 GB` as primary partitions. The remaining space I used as secondary partition for `/home - 189 GB`. I needed to install `windows` in this system and so, I deleted the secondary partition and installed `Windows` on that partition. Now, after the `Windows` installation, I am not able to view my primary partitions anymore. Basically, when the system boots up, I am not able to see the option for `RHEL`. I see only `Windows 7`. The windows 7 size is 189 GB. So, I believe the primary partition is still intact. But I am not able to access it anymore. What should I do to view the `RHEL` OS?


title: How to preserve bookmarks when rearranging pages of a PDF file with tools like pdftk?

text: I am using `pdftk` to rearrange pages of a pdf file with bookmarks/outlines, but after that, the output file lost the bookmarks of the original. My command is `pdftk in.pdf cat 1-22 43 23-42 44-end output out.pdf`. I was wondering how I could keep the bookmarks while rearranging pages?


title: "Xlib: extension "Generic Event Extension" missing on display" warnings

text: How to fix `Xlib` warning: `Xlib: extension "Generic Event Extension" missing on display`? A Google search returns many results but I still can't fix it :(.   I Tried `sudo apt-get install libxcb-event0` but it didn't help. I am using Ubuntu on coLinux on Windows XP.


title: running a program located on my computer on a server

text: There is a server I can SSH into , but I can't use up a lot of the HDD space on it. I want to run a program, but this program is quite large, so I can't just copy it to the server. Is there a way to run a program that's located on my computer on the server via SSH? (both my computer and the server are on the same LAN, I'm running Linux Mint, and the server is running CentOS release 5.9 (Final)).


title: Detach a process from Sh (not Bash) or “disown” for Sh (not Bash)

text: Consider a shell script executed by Sh, not Bash (and I can't change it, and can't use a shebang, it's ignored). The `&` operator works, but `disown $!` does not and makes Sh complains “ _disown: not found_ ”. How do I detach a background process from specifically Sh? I mean, doing from Sh the same as `disown` do from Bash.


title: Whenever I type some wrong command, my terminal tries to run that command in the background

text: Something strange started happening to my terminal. Whenever I type some wrong command it tries to run that command in the background.               hegeek@colinux: ~# l        [9]+  Stopped   l       thegeek@colinux: ~# fdsl            [10]+  Stopped                 fdsl        What could be the issue? * * * EDIT: After restarting the system the issue is solved. But I am still curious what caused this issue. I think it has to do something with `command_not_found_handle` shell function. While trying to find the command, it was doing something weird.


title: Text processing: convert text of table of content into djvu bookmark format?

text: Usually in the table of content of a book, each line is for a chapter or section and ended with its page number, for example,               1 first chapter 10     1.1 first section 11     1.1.1 first subsection 12     1.2 second section 13     2 second chapter 14      2.1 first section 16     2.2 second section 13      The format of bookmark of djvu files for the above example is               (bookmarks      ("1 first chapter" "#10"       ("1.1 first section" "#11"       ("1.1.1 first subsection" "#12" ))      ("1.2 second section" "#13" ))      ("2 second chapter" "#14"       ("2.1 first section" "#16" )      ("2.2 second section" "#13" ))     )      where the main points are the paring of left and right parenthesis for tree- like organization of sections and chapters, double quote for each bookmark item and each page number is preceded by a `#`. The separation between lines and indention are just for convenience to manually view and edit the bookmark text file, and don't matter at all. ### My questions are:   1. I was wondering if there are some convenient ways to convert a plain text file of table of content into djvu bookmark format, which can reduce manual handling as much as possible? This may be achieved by text processing applications, or programming under some programming language, or combination of both.   2. As Suggested with a related reply by Dennis Williamson,  > What you're doing is starting to look a little bit like XML. Perhaps you > should use the real thing and use proper tools to manipulate it. > > a quick google turns up djvuxml. XML files can be easily manipulated using > the appropriate Python or Perl module or shell utilities such as xmlstarlet. I wonder if djvu bookmark format is similar to XML format (I admit I am not familiar with XML yet, but willing to learn it if it can help here)? Can XML tools be used to convert a text file of table of content into djvu bookmark format?


title: Limit rows max and min length

text: I have this input:               XX3083136|bla-bla texthere texttt|asfdasfd@safdsadf.com|SADFdsafsafd|ASDfasfdsafd|DSFSAFD|dsafasfd|sadfsad|     XX3083372|bla-bla-bla this is a text bla-bla|asdfsfda@lsadfasfdda.com|SDFsafas|SADFsa|DFSsdf|asdasdf|sadfdsafsaf|asdfsadf|      and I need this output:               XX3083136|bla-bla texthere textt|asfdasfd@safdsadf.com         |SADFdsafsafd|ASDfasfdsafd|DSFSAFD|dsafasfd|sadfsad|     XX3083372|bla-bla-bla this is a te|asdfsfda@lsadfasfdda.com      |SDFsafas|SADFsa|DFSsdf|asdasdf|sadfdsafsaf|asdfsadf|      So the difference is that I need to control the max text length between the "|". If it's shorter then given line lenght then " " need to be putted. In this example the second row is limited to max 24 chars and the third row has to be at least 30 chars. Different rows will need different max/min limits.. How can I do this in bash?


title: How to sed lines that contain only given form?

text: This is the input:               asdfZE3033141xycf     asdfINSFRHxycf      and I need this output:               asdfZE3033141          asdfINSFRHxycf      So I used a:               echo -e 'asdfZE3033141xycf\nasdfINSFRHxycf' | sed '/asdfZE3033141xycf/ s=xycf$=\n='      but I need this in GENERAL. So I need to sed every:               asdfZE[0-9][0-9][0-9][0-9][0-9][0-9][0-9]xycf      line in a textfile. I just can't put the "[0-9]" in sed. How can I do this?


title: Delete lines from a file using awk or sed based on the variable from previous command

text: I have a CSV file (say temp.csv) with strings and numbers. I need to delete the lines which contain a particular pattern of string at the beginning of the lines in the file. For example, here is my file -               req1,incl_patt1,excl_patt1,2,ind1     req1,incl_patt2,excl_patt2,1,ind1     req1,incl_patt3,excl_patt3,4,ind1     req2,inc_patt1,exc_patt1,1,ind2     req2,inc_patt2,exc_patt2,2,ind2     req2,inc_patt3,exc_patt3,3,ind2     req3,pattern3,expatt3,1,ind3     req4,pattern4,expatt4,1,ind4      I am writing a pattern to `req_file_curr` in a command `~ $ req_file_curr=req1` `echo "${req_file_curr}"` gives output as `req1` However when using it in a **`sed`** command, like below:               sed '/\"${req_file_curr}\"/d' temp.csv      gives output as               req1,incl_patt1,excl_patt1,2,ind1     req1,incl_patt2,excl_patt2,1,ind1     req1,incl_patt3,excl_patt3,4,ind1     req2,inc_patt1,exc_patt1,1,ind2     req2,inc_patt2,exc_patt2,2,ind2     req2,inc_patt3,exc_patt3,3,ind2     req3,pattern3,expatt3,1,ind3     req4,pattern4,expatt4,1,ind4      I am expeceting the output as               req2,inc_patt1,exc_patt1,1,ind2     req2,inc_patt2,exc_patt2,2,ind2     req2,inc_patt3,exc_patt3,3,ind2     req3,pattern3,expatt3,1,ind3     req4,pattern4,expatt4,1,ind4      How can I use the variable from a shell as a pattern to look for in **`sed`** or **`awk`**?


title: Seeing scons file like python file in vim. File dependent properties

text: I know I can `setf python` and then the file is recognized as python. However I must redo this everytime I reload the scons file. I have read some weeks ago that one could write in the last lines of a file with a special syntax and sets parameters that vim should read. In my case I would like `setf python` to be set anytime I open this scons file. However I don't remember the syntax, and I can't manage to find the web site where I read it was possible to have file dependent properties. `#:setf python` on the last line doesn't seem to suffice.


I tried to install MADWIFI on my OpenMediaVault-Server. Any more information needed? I get this error, every time i enter `make`:               root@NAS2024:/media/5703066A59887FF7/Dsys/madwifi-0.9.4# make     Checking requirements... ok.     Checking kernel configuration... ok.     make -C /lib/modules/2.6.32-5-amd64/build SUBDIRS=/media/5703066A59887FF7/Dsys/madwifi-0.9.4 modules     make[1]: Entering directory `/usr/src/linux-headers-2.6.32-5-amd64'       CC [M]  /media/5703066A59887FF7/Dsys/madwifi-0.9.4/ath/if_ath.o     /media/5703066A59887FF7/Dsys/madwifi-0.9.4/ath/if_ath.c:1: error: bad value (armv4) for -march= switch     make[5]: *** [/media/5703066A59887FF7/Dsys/madwifi-0.9.4/ath/if_ath.o] Error 1     make[4]: *** [/media/5703066A59887FF7/Dsys/madwifi-0.9.4/ath] Error 2     make[3]: *** [_module_/media/5703066A59887FF7/Dsys/madwifi-0.9.4] Error 2     make[2]: *** [sub-make] Error 2     make[1]: *** [all] Error 2     make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-5-amd64'     make: *** [modules] Fehler 2      Why has this error occured?


title: Does dropbear take care of hosts.allow and hosts.deny?

text: I'm running `dropbear` as SSH daemon on Debian (actually Raspbian). I tried setting               # /etc/hosts.allow     dropbear:192.168.1.1     # my static ip from which I SSH connect to the device      and               # /etc/hosts.deny     ALL:ALL     # block all others      Then I restarted the whole device. I could still SSH into the device from different IP addresses and even from remote. Did I configure the files wrong or does `dropbear` not support these two files?


title: Custom highlighting for gtksourceview not working

text: I am trying to write my own syntax highlighting for gtksourceview. If it's done it should highlight guitar chords in a text file. This is my unfinished file:               <?xml version="1.0" encoding="UTF-8"?>     <language id="tab" _name="Tab" version="2.0" _section="Others">       <metadata>         <property name="mimetypes">text/plain</property>         <property name="globs">*.txt;*.tab</property>       </metadata>            <styles>         <style id="chord" _name="Chord" foreground="blue" bold="true"/>       </styles>            <definitions>              <context id="chord" style-ref="chord" class="no-spell-check">           <match>[A-H]</match>         </context>              <context id="tab">           <include>             <context ref="chord"/>           </include>         </context>            </definitions>     </language>      I would expect every capital A to H to be blue and bold in the highlighted text. Is saved the file to `/usr/share/gtksourceview-3.0/language-specs` and I am able to select it in GEdit. But nothing is highlighted in the text. Can anyone tell me what I am doing wrong?


title: How to use the SVN CLI effectively

text: How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these:   * find modified files in directory   * commit only SOME of them      * selecting them somehow other then remembering their names   * list unversioned files      * add only some using some efective way other then remembering them   * revert only some files in certain directory I was used to TortoiseSVN on Windows, but a switch to OSX (which is quite linux-like) forced me to use SVN's CLI, as other clients are bad or really expensive.


title: Why isn't there a truly unified package manager for Linux?

text: Why isn't there a unified package manager that acts as an interface between the end-user and the underlying low-level package manager (`apt`, `yast`, `pacman`, etc.)? Is it hard to do and therefore not practical, or is there a genuine obstacle making it impossible to do?


title: How would I auto click for a Centos server?

text: Is there any way to do auto clicking on CentOS? I have tried googling for a simple auto clicker and couldn't seem to find any (yet Ubuntu seemed to have promising results). Is there any well known auto clicker out there for CentOS? Or maybe is there a way to do it without even needing to install a program?


title: how to merge pdf files so that each file begins on an odd page number?

text: I need to merge a few dozed pdfs, and i want all of the input pdfs to start on an odd page in the output pdf. Example: A.pdf has 3 pages, B.pdf has 4 pages. I _don't want_ my output to have 7 pages. What i want is an 8-page pdf in which pages 1-3 are from A.pdf, page 4 is empty, and pages 5-8 are from B.pdf. How can i do this? I know about pdftk, but i didin't find such an option in the man page.


title: Send only one warning when the private key is not available

text: For added security, I would like to require a private key to use sudo on my Ubuntu Server box. I've added private key authentication for sudo as described at http://superuser.com/questions/164078/how-to-make-shared-keys-ssh- authorized-keys-and-sudo-work-together. I've also attempted to disable password-based authentication by making `/etc/pam.d/sudo` read as follows:               #%PAM-1.0          auth    required   pam_env.so readenv=1 user_readenv=0     auth    required   pam_env.so readenv=1 envfile=/etc/default/locale user_readenv=0     auth    [success=1 default=ignore]   pam_ssh_agent_auth.so file=/etc/security/authorized_keys     auth    requisite  pam_deny.so     auth    required   pam_permit.so     auth    optional   pam_cap.so          @include common-account     @include common-session-noninteractive      It seems to work, but I wanted to check to make sure that I wasn't overlooking a massive security hole. Also, if I try to use sudo without having a private key, it tries three times before failing:               Sorry, try again.     Sorry, try again.     Sorry, try again.     sudo: 3 incorrect password attempts      This isn't a terribly big deal, but I do get a security warning e-mail every time, so it would be nice to make it only try once.


title: Use rsync to just get a folder and its content with a pattern

text: I've looked all around the internet, looked in regexp sites and everything else, but I'm unable to write a rsync command to fetch what I want to. I need to mirror the FreeBSD release, but I don't need the RC versions and BETA versions, so I just need to rsync any folder with RELEASE in it's name with all files and subfolders of this folder. At this moment I've this command running without success:               rsync -vaz --delete --dry-run ftp2.br.freebsd.org::FreeBSD/releases/amd64 /usr/repos --include=".{0,}(RELEASE)" --filter="-! */"      Let's image the following folder structure:               amd64/8.3-RELEASE/     amd64/8.4-RC2/     amd64/amd64/10.0-RC5/     amd64/amd64/10.0-RELEASE/     amd64/amd64/9.1-RELEASE/     amd64/amd64/9.2-BETA1/     amd64/amd64/9.2-BETA2/     amd64/amd64/9.2-RC1/      In this case rsync should only get:               amd64/8.3-RELEASE/     amd64/amd64/10.0-RELEASE/     amd64/amd64/9.1-RELEASE/


title: Solaris default install (user tools)

text: Many questions on this forum as well as other places really boils down to somebody coming from Linux environment and then not being able to use the equivalent command on Solaris. Often this is because of different options supported, etc. This question intends to document (Q&A style) of what a reasonable Solaris install should always include. Never again should a user be frustrated because something isn't available. We focus on the packages most often asked for by Solaris newbies/visitors in questions. This is about standard userland tools such as `find`, `grep` and what have you. If you are looking for a similar posting about development tools (e.g. compiler, make, etc) then you should look here.


title: Setting up apache axis client on centos

text: I have below codes.               import java.util.*;     import java.io.*;     import java.net.URLConnection;     import java.net.MalformedURLException;          import org.apache.axis.client.Call;     import org.apache.axis.client.Service;     import org.apache.axis.encoding.XMLType;     import javax.xml.namespace.QName;     import javax.xml.rpc.NamespaceConstants;     import javax.xml.rpc.ParameterMode;     import java.net.URL;          public class doWebService     {           public      static void doWebService()           {                 try                 {                       ////////////////////////////////////////////////////////////////////                       // Responds the same with or without the ?WSDL                       String      strEndPoint       = "http://www.deeptraining.com/webservices/weather.asmx";                       String      strSoapAction     = "http://litwinconsulting.com/webservices/GetWeather";                       String      strSchemaURL      = "http://litwinconsulting.com/webservices/";                       String      strParamName1     = "City";                       String      strParameterVal1= "Murfreesboro";                       String      strFunctionName   = "GetWeather";                            //Call      call   = (Call) new Service().createCall();//Works                       Call  call   = new Call(strEndPoint);//Works same                            ////////////////////////////////////////////////////////////////////                       // first parameter in QName seemingly takes ANYTHING                       call.setOperationName(new QName(strSchemaURL, strFunctionName));                            ////////////////////////////////////////////////////////////////////                       // Set the name of the parameter and the return type                       call.setReturnType(XMLType.XSD_STRING);                       call.addParameter(new QName(strSchemaURL,strParamName1), XMLType.XSD_STRING, ParameterMode.IN);                       //                       ////////////////////////////////////////////////////////////////////                       // Catch the result and print it                       // Parameter count is now ONE (1).                       call.setSOAPActionURI(strSoapAction);//Yes Necessary                       String      strResult = (String) call.invoke(new Object[] {strParameterVal1});                       System.out.println("Result='" + strResult + "'");                 }                 catch (Exception e)                 {                       e.printStackTrace();                       System.err.println(e.toString());                 }           }                public static     void main(String[] args)           {                 ////////////////////////////////////////////////////////////////////////                 //    6 Call a Web service (with parameters)                 doWebService();           }     }      As I compile I got this errors. I know because I am missing the library. So I downloaded from here http://axis.apache.org/axis2/java/core/download.cgi the binary distribution. Normally all my library I put .jar file all in /usr/java/jdk1.7.0_03/jre/lib/ext. So which .jar file should I put in there. How about the xml rpc where to get those library ?               doWebService.java:6: error: package org.apache.axis.client does not exist     import org.apache.axis.client.Call;                                  ^     doWebService.java:7: error: package org.apache.axis.client does not exist     import org.apache.axis.client.Service;                                  ^     doWebService.java:8: error: package org.apache.axis.encoding does not exist     import org.apache.axis.encoding.XMLType;                                    ^     doWebService.java:10: error: package javax.xml.rpc does not exist     import javax.xml.rpc.NamespaceConstants;                         ^     doWebService.java:11: error: package javax.xml.rpc does not exist     import javax.xml.rpc.ParameterMode;                         ^     doWebService.java:30: error: cannot find symbol                       Call  call   = new Call(strEndPoint);//Works same                       ^       symbol:   class Call       location: class doWebService     doWebService.java:30: error: cannot find symbol                       Call  call   = new Call(strEndPoint);//Works same                                          ^       symbol:   class Call       location: class doWebService     doWebService.java:38: error: cannot find symbol                       call.setReturnType(XMLType.XSD_STRING);                                          ^       symbol:   variable XMLType       location: class doWebService     doWebService.java:39: error: cannot find symbol                       call.addParameter(new QName(strSchemaURL,strParamName1), XMLType.XSD_STRING, ParameterMode.IN);                                                                                ^       symbol:   variable XMLType       location: class doWebService     doWebService.java:39: error: cannot find symbol                       call.addParameter(new QName(strSchemaURL,strParamName1), XMLType.XSD_STRING, ParameterMode.IN);                                                                                ^       symbol:   variable ParameterMode       location: class doWebService


title: Send a command to a running tmux session (like screen -X)

text: I'm looking to switch from screen to tmux for my terminal multiplexing needs, but there's a feature of screen that I need to replicate in tmux: the -X option, which allows one to run arbitrary screen commands inside an existing screen session. This allows me to modify a running screen session's environment to point to a new X server, since my screen sessions tend to live longer than my X11 logins. For example, I could put something `screen -X setenv DISPLAY $DISPLAY` in my X11 startup scripts. Anyway, is there a way in tmux to send arbitrary commands to a running tmux session? Alternatively, a way to update environment variables in a running tmux would be acceptable.


title: Linux 3.x: what wireless chipsets will support a bridged connection?

text: I have asked a similar question on the Ubuntu pages but this is likely a generic Linux issue: what variety of wireless cards/drivers will support being placed in a bridged connection? I have been using very old Prism II hardware as it worked while I believe more recent cards did not, but the old hardware died, killing the bridge.


title: Killing multiple instances of the script from the script itself

text: I've couple instances of script.sh running in parallel, doing the same thing, running in background. I'm trying to use a function to kill all the current running scripts when executed. So, for example, ./script.sh -start will start the script (which I can run few in parallel) and when I execute ./script.sh -kill will kill all instances of the script.               f() {                  procName=`basename $0`                  pidsToKill=`ps -ef | grep $procName | grep -v grep | awk '{ print $2 }'`                  if [[ $pidsToKill ]]; then                         for i in $pidsToKill; do                              kill -9 $i                         done                         echo "Killed running scripts."                  else                         echo "No opened scripts to kill"                  fi     }      For some reason, sometimes it kill couple of the scripts and sometimes returns an error. I've figured a way to solve this, but I wanna understand why this one doesn't work. Any ideas?


title: Battery standby

text: I am using a lenovo z570 laptop. In windows I am able to use the laptop for around 2.30 hrs in normal usage.But when I use any Linux distro the battery drains a lot faster. I am able to use only for 40mins or so.where could the problem be?