title: Unison can't synchronize Dropbox configuration (socket files)

text: I'm using Unison to synchronize my home across several computers, and I've addressed everything but this. The Dropbox configuration is partially skipped, and as a result Dropbox thinks there is no configuration and goes through the configuration wizard again. Here's the output from Unison related to dropbox:               Reconciling changes                                                                   <-?-- dir        .dropbox                <---- dir        .dropbox-dist                <---- dir        .dropbox-dist-new       [BGN] Copying .dropbox from /home/.nfs/jorge.suarez/linux-home to /home/remoto/jorge.suarez     [END] Copying .dropbox     [BGN] Copying .dropbox-dist from /home/.nfs/jorge.suarez/linux-home to /home/remoto/jorge.suarez     [END] Copying .dropbox-dist     [BGN] Copying .dropbox-dist-new from /home/.nfs/jorge.suarez/linux-home to /home/remoto/jorge.suarez     [END] Copying .dropbox-dist-new       partially transferred: .dropbox      Here's the original contents of the directory:               $ ls -lah     total 22M     drwx------  3 jorge.suarez users 3,9K 2013-01-25 21:39 .     drwxr-xr-x 43 jorge.suarez users 3,9K 2013-01-25 21:40 ..     srw-------  1 jorge.suarez users    0 2013-01-25 21:39 command_socket     -rw-------  1 jorge.suarez users 3,0K 2013-01-25 21:39 config.db     -rw-------  1 jorge.suarez users  20K 2013-01-25 21:39 config.dbx     -rw-------  1 jorge.suarez users  66K 2013-01-25 21:39 deleted.dbx     -rw-------  1 jorge.suarez users    4 2013-01-25 21:39 dropbox.pid     -rw-------  1 jorge.suarez users 2,0M 2013-01-25 21:39 filecache.dbx     -rw-------  1 jorge.suarez users   89 2013-01-25 21:39 host.db     -rw-------  1 jorge.suarez users  221 2013-01-25 21:39 host.dbx     -rw-------  1 jorge.suarez users   81 2013-01-25 21:39 hostkeys     srw-------  1 jorge.suarez users    0 2013-01-25 21:39 iface_socket     drwx------  2 jorge.suarez users 3,9K 2013-01-25 21:39 l     -rw-------  1 jorge.suarez users  13K 2013-01-25 21:39 photo.dbx     -rw-------  1 jorge.suarez users  20M 2013-01-25 21:39 sigstore.dbx     -rw-------  1 jorge.suarez users  232 2013-01-25 21:39 unlink.db      And the synchronized one, just before Dropbox gets a chance to be launched:               $ ls -lah     total 22M     drwx------  3 jorge.suarez users 4,0K Xan 25 22:09 .     drwx------ 43 jorge.suarez users 4,0K Xan 25 22:10 ..     -rw-------  1 jorge.suarez users 3,0K Xan 25 22:09 config.db     -rw-------  1 jorge.suarez users  20K Xan 25 22:09 config.dbx     -rw-------  1 jorge.suarez users  66K Xan 25 22:09 deleted.dbx     -rw-------  1 jorge.suarez users    4 Xan 25 22:09 dropbox.pid     -rw-------  1 jorge.suarez users 2,0M Xan 25 22:09 filecache.dbx     -rw-------  1 jorge.suarez users   89 Xan 25 22:09 host.db     -rw-------  1 jorge.suarez users  221 Xan 25 22:09 host.dbx     -rw-------  1 jorge.suarez users   81 Xan 25 22:09 hostkeys     drwx------  2 jorge.suarez users 4,0K Xan 25 22:09 l     -rw-------  1 jorge.suarez users  13K Xan 25 22:09 photo.dbx     -rw-------  1 jorge.suarez users  20M Xan 25 22:09 sigstore.dbx     -rw-------  1 jorge.suarez users  232 Xan 25 22:09 unlink.db      It seems `iface_socket` and `command_socket` are skipped because they are socket files. Is there anything I can do about this? As a workaround, I could just parse the Unison output and create the socket files by hand. That should fix this particular issue, but the problem would remain for other socket files since the Unison output doesn't contain the name of the skipped files.


title: Capturing image from webcam

text: I want to capture a image through webcam in Linux. So I searched on the Internet and found out it's can be done using mplayer or vlc. Following is the command for capturing image by mplayer and its corresponding error.               [root@localhost ~]# mplayer -vo png -frames 1 tv://          MPlayer SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team     mplayer: could not connect to socket     mplayer: No such file or directory     Failed to open LIRC support. You will not be able to use your remote control.          Playing tv://.     TV file format detected.     Selected driver: v4l2      name: Video 4 Linux 2 input      author: Martin Olschewski <olschewski@zpr.uni-koeln.de>      comment: first try, more to come ;-)     v4l2: unable to open '/dev/video0': No such file or directory     v4l2: ioctl set mute failed: Bad file descriptor     v4l2: 0 frames successfully processed, 0 frames dropped.               Exiting... (End of file)     [root@localhost ~]#       Please help me in solving this error. I searched on the net and found out about v4l2, but still can't solve the problem.               [root@localhost ~]# lsusb     Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub     Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     [root@localhost ~]#       I am using Fedora in VMWare Workstation 9. I wonder if that is the problem.


title: No output from inotifywait | awk

text: I'm attempting to use part of a one-liner found here: Script to monitor folder for new files? When I try the following procedure I get no output whatsoever and I cannot figure out why. In terminal 1:               inotifywait -m ~/somefolder | awk '{ print $3; fflush() }'       Then in terminal 2:               touch ~/somefolder/newfile      When not piping to awk, inotifywait lists all the expected events to stdout and has no problem redirecting to a file either. Awk also appears to work correctly independent of inotifywait on text piped to it structured like the output of inotifywait. Using the two together just doesn't work for me. EDIT: awk was an alias for mawk on my machine which didn't work. gawk, however, came through and worked as expected.


title: CentOS 5.9 | Program Listening on Port, Causing It Not To Bind

text: I have a game server running on my CentOS box that binds to port 28960, now when I restarted the game server it stated that it can't bind the port because its in use, but its obviously because the server was restarted, but the port was not closed? How do I check to see if the program is listening, and if its not, then how would I clear the port, so I can start the server back up on port 28960?


title: Select unicode filename in Bash

text: Ok; suppose I'm in Bash and I have several files in a folder. Several of them are named `file☠☡☢☣.txt`, where `☠☡☢☣` starts with crazy untypable unicode characters. How would I refer to one of them? Pushing tab only auto-completes to `file`, and then it wants you to type a crazy character. Is there some way to tell bash "select the 3rd one in that list you just gave me"?


title: How to compile a downloaded .zip file

text: I've downloaded this zip file from GitHub and I need to compile it. I have no idea how to go about the compilation.


title: grep block of lines

text: I want to `grep` every block of lines that has starting line with "CK \" at the end of line and ending line that has "D \" at the end of line, I can use sed/awk/grep etc. So far i have tried following with no luck:               $ sed -e '/CK \\$/,/D \\$/' file | more         Here is the example of one of the blocks.                pcs_dual_logic/e3bis_chbist_jj/e3bis_ch_ptn_gen_cur_st_reg_1_/CK \       pcs_dual_logic/e3bis_chbist_jj/e3bis_ch_ptn_gen_cur_st_reg_1_/Q \       pcs_dual_logic/e3bis_chbist_jj/U341/X \       pcs_dual_logic/e3bis_chbist_jj/U331/X \       pcs_dual_logic/e3bis_chbist_jj/U70/X \       pcs_dual_logic/e3bis_chbist_jj/U487/X \      pcs_dual_logic/est_jje3bis_ch_ptn_gen_e3bis_random_data_gen_random_data_reg_6_/D \


title: Vim shortcuts in insert mode

text: When I'm entering some text in `vim`, sometimes I need to jump to some other place and enter more text. I know there are some shortcuts with `ctrl` key to simplify the movement. What are the most useful keyboard shortcuts in insert mode? e.g. I have:               'text_sample'      The cursor is in `_` position. I want to jump to the end of line without having to press `ESC` and `ctrl` \+ `A`.


title: Linux shell - Sending messages to another user

text: Is there any command to send messages through the Linux shell to other people on the same network? I'm using `write user` and then write the message itself. But there's any command that doesn't show my username or that i'm trying to message them The command I'm using will show this to the user I'm trying to contact (code taken from the web):               Message from root@dev.example.com on pts/1 at 17:11 ...


title: How to install Linux Mint on 24GB SSD alongside 1TB HDD

text: I had a Lenovo laptop with Windows 8 on it but I wanted to switch to Linux Mint. After disabling UEFI secure boot and some other things I managed to get Linux Mint installed on the 24GB SSD. I'm new to this so I assumed that the install wizard would sort out everything so that it would work alongside my 1TB HDD. I realize I was mistaken. My question is, **what is the best way to set up/install Linux Mint using the 24GB SSD and the 1TB HDD?** From what I've found online I've just got more confused as there seems to be many different ways of doing this. Basically I think I need to choose a drive for 1: the OS, 2: the swap space, 3: the data. Also, what do I do with the partitions in the 1TB HDD. There are currently 7 partitions on it....   1. 949GB: windows8_OS (NTFS)   2. 24GB: lenovo drivers (NTFS)....are these important?   3. 21GB: Microsoft Windows Recovery Environment (NTFS)   4. 1GB: Microsoft Windows Recovery Environment (NTFS)   5. 1GB: bfbfafe7-a34f-448a-9a5b-6213eb736c22 (FAT32)....I think this is windows related?   6. 273MB: EFI System (FAT32)   7. 134MB: Microsoft Reserved (unknown) Laptop info:   * Lenovo ideapad u410 touch   * Processor: Intel® Core™ i7-3537U CPU @ 2.00GHz × 4    * Memory: 7.7GiB I use my laptop mostly for heavy browsing, watching movies, programming, wordprocesing etc


title: Using environment variabless in Tmux status bar shell commands

text: I am attempting to create a tmux status bar which shows three timezones: `US Eastern Time :: UTC :: Central European Time`. Using the `TZ` environment variable makes the `date` command show the time in a given timezone. I was attempting to do so with this tmux.conf setting: ` set -g status-right "#[fg=white]#S #I:#P #[fg=yellow]:: %d %b %Y #[fg=green]:: #(TZ=America/New_York date +%H:%M) :: #(date -u +%H:%M) UTC :: #(TZ=Europe/Belgrade date +%H:%M)" ` However, passing `TZ=foo` does not work inside of `#(…)`. (I get the server `date` instead of what I expected). Any suggestions?


title: config fstab file for a diefferent partition root directories

text: I have copied my `/var /opt /usr` directories to a newpartititon and now I need to configure the `fstab` file. That is the new partition content:               drwxr-xr-x  6 root root  4096 Dec 20 12:16 opt     drwxr-xr-x 10 root root  4096 Dec  8 06:52 usr     drwxr-xr-x 11 root root  4096 Dec 21 08:35 var      This is how I want to change the `fstab` file:               # <file system> <dir>   <type>  <options>   <dump>  <pass>     tmpfs       /tmp    tmpfs   nodev,nosuid    0   0     UUID=00e31411-0730-9903-c038-45c4014ce600 / ext2 defaults 0 1     UUID=4bbbd587-1439-427b-9584-5b36d904f4c3 /home ext4 defaults 0 1     UUID=5a694838-c110-4eb9-9703-c490792af400 swap swap defaults 0 0     UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /var     UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /opt     UUID=7502c4a6-f13b-40e7-ab3c-aaaa630d6b4d /usr      Will the `fstab` file detect the subdirectories in each partition or should I put each directory in its own partition? Since in my `/home` partition, there is the home's contents and not another home directory, I think that the above configuration wouldn't work, since in the new partition i have three separate directories. What you think is the best way to do that via one partition ?


title: APT pinning or faking the version number of my own package?

text: I'd like to create my own repository for personal use across a number of machines. Packages will be signed as usual and some of the packaged software will be the same as provided by the official Debian and Ubuntu repositories, but (usually) newer - but not always, sometimes it will be the same. Again, my repository will contain only a subset of the packages available in the official repositories. Which method is easier to maintain if this is a personal repository:   * fake the version number of the packages to be always x+100 or similar, where x would be the major version of the original upstream software   * pin it using APT pinning APT pinning is still a somewhat arcane concept to me. I have used it, but it also led to some unusual and unwanted problems in the past. The idea is that my own repository takes precedence for packages available in the official and my repository alike.


title: Trying to get started with Unix on a Windows laptop

text: I caught a cold and my brain hurts just looking at the pc screen but I wanna get started learning Unix asap. Basically, I've acquired another laptop and I want to install Unix on it so I can try it out and see if I even have a chance at gaining proficiency. I feel like it's mandatory to use if I want to dig deeper into computer systems and programming. Which state of Unix should I use? Daemon? Ubuntu? How do I get it up and running on a windows laptop? I should be able to find books or tutorials but if you know of any that are better than the rest that would help too.


title: Count duplicate rows with constraint

text: I have the following file:               A B 1990     A C 2001     A C 2013     A B 2001     B C 2013     A D 2001     A D 2014      I need to count duplicate pairs (in the 1st and 2nd column) and to each such pair assign the lowest value from the 3rd column. For my toy file the output should be:               A B 2 1990     A C 2 2001     A D 2 2001     B C 1 2013      For example, pair `A B` occurs two times, first time with value 1990 and second time with value 2001, because 1990 < 2001 we assign 1990 to this count. I wonder how to do that with Linux tools (Bash, AWK, Perl). Any ideas / pointers would be greatly appreciated.


title: Bash options and interactive shells

text: The -s option to bash doesn't seem to really do anything When I execute commands with or without it nothing changes. What really confuses me is when I execute a shell script I always seem to be getting an interactive shell. I'm assuming it's interactive because when I use the read builtin in the script it will always prompt me for input. Does this make it interactive? Do shell script run as interactive in fedora, and are there any examples of a difference that the -s can make? I have read the man pages, but can't seem to generate any examples on my own that would have any effect. I combined the two questions because I was trying to use s to change how the script received input, and in some tutorials they say it has an effect. I realize that it can set arguments, what I don't get is how it changes it to read from standard input it always seems to do that anyway Here is what I used to test it               if [ -v $PS1 ]     then       echo non-interactive     else       echo interactive     fi     read ; echo $REPLY      read was always able to work in both non and interactive shells Even when I tested for the presence of fd/0 and fd/1 in non-interactive shells they still existed Thanks in advance


title: How to make SSH tunnel as daemon?

text: Actually, I need a secured VPN, but configuring it was too hard for me. So I decided to use SSH tunnel. The tunnel could be established when I logged in. :( (1) How can I make a SSH tunnel without login? Like daemons. And (2) how can I keep the tunnel connections reliably? I'm using `Ubuntu Server 10.04 LTS`.


title: Use find to find certain directory and delete all files in it except one directory

text: I'm having the following problem. I have a directory structure and want to delete everything that is within a directory named `Caches`. Everything should be delete except all directories named `Snapshots`. I can't figure out how to do this with **find** or any other command I know. The reason I'm asking: On iOS every app has its own Caches directory. These sometimes don't get cleared properly, depending on the app. With the solution to this answer, one would be able to clear Caches on iOS, and therefore optimize the disk space, when the devices' drive is mounted on another computer, e.g. with FUSE (iExplorer). This is what I have so far:               find . 2>/dev/null -type d -name "Caches" -maxdepth 3 -print      This returns something like:               ./Library/Caches      When I do a `ls ./Library/Caches` I see all contents and the `Snapshots` directory, which I want to exclude because ultimately I want to `-delete` everything except this one. * * * I want something like this:                 Before:                            After:            .                                  .       ├── a                              ├── a       │   ├── a                          │   ├── a       │   └── Caches                     │   └── Caches       │       ├── a                      │       └── a       │       │   └── Snapshots          │           └── Snapshots       │       │       └── a              │               └── a       │       ├── b                      └── b       │       │   └── a                      └── c       │       └── c                         └── b           ├── c           └── Caches               ├── a               │   └── foo               │       └── a               └── b                   └── a


title: Super lightweight script to receive incoming email and forward to script

text: I need a very simple daemon script that receives all emails to a domain name and just forwards them to a script. I know there's software like exim, qmail or others to do this, but I do not want to install big software that eats performance in the host. I have the MX record of the domain pointing to the host; now I need some daemon listening on port 25 and answering correctly to the mail standard communications (HELO and that stuff), and then handing the mail to a script. How can I do that? * * * **Edit** : the domain.com will JUST be incoming, I don't need that domain to have POP accounts, or send emails; the domain will just receive emails addressed to `*@domain.com`, and I would like all of them to be redirected to a script. I would like it in C or Perl if possible


title: Search low values in mainframe files

text: I am working with mainframe files and it seems that the low values (x'00') exists in the records in the file which throws off my import for fixed block. Does anyone know how to eliminate those characters in Linux?


title: Decomposition of path specs into longest-common-prefix + suffix

text: Given any two absolute Unix path _specs_ 1, one could decompose each spec as the concatenation of a longest common prefix and a specific suffix. E.g.,               /abc/bcd/cdf     -> /abc/bcd + cdf     /abc/bcd/chi/hij -> /abc/bcd + chi/hij      Is there a Unix utility (or utilities) to compute such decomposition? (I added "or utilities" in case there are separate utilities for computing the longest common prefix and for computing relative paths.) (I realize that it would not be extremely difficult to code such utilities, but I try to give priority to tools that are more or less standard over custom-made ones, whenever possible.) 1I write "path spec" rather than "path" to sidestep issues like existence (of the paths) in a given filesystem, links, etc.


title: md5 or sha1 while copying a file

text: Is there a way in any linux distro to perform a md5sum or sha1 check while the file is being transferred from a local partition to an NFS one? Example: I have a NFS mounted drive and a very big file on my local drive. I'd like to transfer that file to the NFS mounted drive and at the same time, do a md5 check. I found a lot of scripts that would do the md5 after the file was copied on the remote drive but since it's a very big file 100GB+ I'd like to know if there's a way to take advantage of the fact that the file is already being red while being transferred.


title: Bash No Longer Changes Directory

text: My bash shell will no longer change directory with cd. I noticed it earlier when working and found that any new shells I opened (terminal or xterm etc) would be stuck in the home directory and could not get out (already open terminals continued to work fine).               [~]$ pwd     /home/sys/dave     [~]$ cd /     [~]$ cd Documents/     [~]$ pwd     /home/sys/dave     [~]$ type cd     cd is a shell builtin     [~]$ alias     alias l.='ls -d .* --color=auto'     alias ll='ls -l --color=auto'     alias ls='ls --color=auto'     alias vi='vim'     alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'      I thought it must be some weirdness I didn't have time to deal with such as a handler out of memory (having checked that cd wasn't aliased and using the builtin version). So I (yes, I know) rebooted the machine. Fresh boot, exactly the same problem. CSH on the other hand works fine, so immediately after the snippet above:               [~]$ csh     [~]$ cd /     [/]$ pwd     /     [/]$ cd ~/Documents/     [~/Documents]$ pwd     /home/sys/dave/Documents     [~/Documents]$       I haven't installed anything new or performed any updates in the last few days and it was working fine until late this evening. Ideas/assistance/HELP much appreciated! ** UPDATE ** So digging around I found this line in .bashrc               export PROMPT_COMMAND="cd"      If I unset PROMPT_COMMAND then everything works as normal. But... WTF. I didn't put this line in the .bashrc and everything was working perfectly until tonight. Should I just comment it out, manually unset it, or just burn the computer as a witch?


title: Concatenate block of lines with following block of lines

text: I am trying to process some text exported from lecture slides using pdf2text. The bullet points of some slides show up like this:               title for the list     -     -     -     a bullet point text     another bullet point text     yet another bullet point text     - nested bullet point     - another nested bullet point     - yet another nested bullet point     title for the next list      I would to concatenate these into a correct (markdown) list like this:               title for the first list          -   a bullet point text     -   another bullet point text     -   yet another bullet point text         -   nested bullet point         -   another nested bullet point         -   yet another nested bullet point          title for the next list


title: How to add existing normal partition into LVM in Linux?

text: I'm having a partition in Linux with some data, I want to add this partition into LVM, which is already running in the same system. What will be the step to do so?


title: List of files accessed by application

text: I want to install propertiary AMD driver but I would also like to know which files were created/changed by installer. Is there some application which can observe (probably by inotify) which files were changed by run application?


title: What to do with an executable file that simply doesn't execute?

text: I downloaded the Linux executable for Unetbootin 494, and now I'm trying to run it. As root, I made it executable and attempted to execute it:               chmod +x unetbootin-linux-494     ./unetbootin-linux-494      Nothing happens and no output is displayed. `ps -e | grep unetbootin` shows nothing either. The file's size looks right (4.3 MB), although I don't see a checksum on sourceforge with which to verify it. I'm running it on my `/home` partition (as root, though), so the filesystem isn't non-executable. How can I execute this file, or at least debug the problem further? I'm using Debian x64.


title: dhcp: way to check the online status of the device

text: On Linux there is the file `/var/lib/dhcpd/dhcpd.leases`. I need to determine, for the devices for which information contained in this file, whether the device is online at a given moment. Is there any way other than to parse the file and ping addresses contained in it?


title: Alternative to mrouted for DVMRP on Debian Squeeze

text: I need to implement DVMRP protocol to route multicast over Openvpn (tun) connection for some old 3Com NBX phones. I use Debian squeeze so mrouted is not available (obsolete). What can I use instead?


title: for loop in bash function

text: I recently wrote the following `bash` function:               makeaudiobook () {     count=1     almbumartist=$2     for f in $1; do             preprocess $f > $f-preprocessed             text2wave $f-preprocessed -o $f.wav             lame -b 16 --tt $f --ta $albumartist --tl $albumartist --tn $count $f.wav $f.mp3             rm -rf $f.wav $f-preprocessed             count=$(($count+1))     done     }      It does not work as expected. It does not iterate over all of the files that fit the glob expression I specify in `$1`. As a one-liner, this would work. An in fact, I made this into a function because I was tired of writing it out as a one-liner. But as a `bash` function, it doesn't work. So what do I need to do to make it work? I want to be able to call it on things like the output of `split`, like,               me@localhost$~ makeaudiobook x?? haskell      ...where `x??` matches xaa, xab, xac, etc. Like I said, as a one-liner this is fine. So what do I need to do to pass this glob expression to `$1`?


title: I need a text editor to edit/visualize >10GB text files

text: So as to vizualize, and hopefully edit, a very large text file, more than 10GBytes (a backup dump of whole database), I have tried using vim... it didn't behave very well. I have also tried cat to at least visualize, and cat didn't not behave properly neither. Are there tools for huge file editing ? Something that would view/edit by a limited group of lines without trying to load the rest, unless told to load a new group (really limited) of lines, and maybe the possibility to jump certain places thanks to a search utility.


title: is there a "xdotool" rpm available for Centos Linux?

text: It seems to be extremely difficult to install xdotool   on CentOS because of it's requirements. such as               yum groupinstall 'Development Tools' -y     yum install libXi-devel libXtst-devel libXinerama-devel -y      the top one especially is difficult to move to a folder and install locally. ( without internet ). ( for extra speed ). Currently I have to run those two commands and then I have to run these in order to install `xdotool` on CentOS Linux.               cat > /etc/ld.so.conf << "EOF"     /usr/local/lib     EOF     # rm -rf xdotool-2.20110530.1     # tar -xvf xdot*     cd xdot*     make install      I tried adding `epel` and `rpmforge` repos to my yum and then I searched for `xdotool` nothing was found. I was wondering if there is a known rpm version so that installing it would be simple on CentOS Linux.


title: How to check the process along with its arguments in process list?

text: I have written a script where i need to pass several arguments with the same script, the script is being executed after a certain time using cron. In order to make sure that there are no multiple instances of the scripts running, i've made a check to check if the process of the script is running using `ps -ef | grep -v grep | grep Connection_Manager.sh` I want to check which arguments are being used in the running process of the script when i perform a check using `ps -ef`. How can i check the arguments which are being used in the running process of the script?


title: Ssh 'access denied' from one host but not the other

text: Consider the following scenario: I have a Debian-ssh-server setup and exposed it to the internet for some time for testing. Also I have an account which is basically configured as root in the `sudoers` file (I know this is poorly mis-configured!) and of course no root login is permitted. The authentication is password and not key based. What happened is the following, I have set up the server from my own laptop and I could login to this account from anywhere, at home of course and even from other networks. But as I tried to login from another machine I got the 'access denied' message. What grinds my gears is why could I login from my home machine, the access should have been denied either, shouldn't it?


title: Finding the PID of the process using a specific port?

text: I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy. I used `netstat -nlp|grep 9000` to see if such a port exists and I got this:                  tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      But how can I get the PID of the process which is holding it?


title: cgroups, cpuset changing the cpuset of some processes fail

text: I am trying to "reserve" a core on a CPU for performance measurement. I have mounted a cpuset cgroups vfs. I created two subgroups like this:               /cpuset.cpu_exclusive    1     /cpuset.cpus             0-3     /cpuset.mems             0          # Everything on the PC except what I want to measure     /All/cpuset.cpu_exclusive    1     /All/cpuset.cpus             1-3     /All/cpuset.mems             0          # The measurement processes only (i.e. the shell + a binary to test)     /Timing/cpuset.cpu_exclusive    1     /Timing/cpuset.cpus             0     /Timing/cpuset.mems             0      I am able to move many processes to the "All" group, but I fail to do so for some (those who look like kernel processes). For instance, ksoftirqd has a pid of 3:               [root@Io:/vfsroot]# echo 3 > All/tasks      echo: write error: invalid argument      Moreover, for some process I can see them in All/tasks but they'll still be running on the wrong cpu (here cpu #0, with a shell).               [root@Io:/vfsroot]# echo 28362 > All/tasks      [root@Io:/vfsroot]# ps -eo pid,psr | grep "0$"     ...     28362   0      For those I am wondering whether that's because they have not woken up since I changed their cpuset and ps displays the last cpu they ran on... I can change my current shell cpu quite effectively. (Make it appear and disappear from /Timing/tasks and see it change CPU with ps) I am using the latest version of Ubuntu and installed cgroups using apt-get if that matters.


title: grep filter all lines plus one before each hit

text: I want to parse some output so I exclude all lines that contain either `foo` or `bar`, as well as all lines immediately preceding those lines. For example:               echo "     1 some line     2 line to exclude because the next line has one of the terms     3 line with foo     4 line to exclude because the next line has one of the terms too     5 line with bar     6 another line     ">InputFile      I want the output:               1 some line     6 another line      I tried `cat InputFile|grep -v "foo"|grep -v "bar"`, but it doesn't exclude line 2 and 4, and the option `-B1` for the line before doesn't work either.


title: How do I disable the touch screen on my laptop?

text: My laptop has a touchscreen but I do not use this. How do I disable this functionality? I use Arch Linux. I figured I could try removing the related driver. According to this page the possible drivers are all named `xf86-input*`. However, it looks like I have nothing like that installed:               # pacman -Qs xf86-input     local/xf86-input-evdev 2.8.3-1 (xorg-drivers xorg)         X.org evdev input driver     local/xf86-input-joystick 1.6.2-3 (xorg-drivers xorg)         X.Org Joystick input driver     local/xf86-input-keyboard 1.8.0-2 (xorg-drivers xorg)         X.Org keyboard input driver     local/xf86-input-mouse 1.9.0-2 (xorg-drivers xorg)         X.org mouse input driver     local/xf86-input-synaptics 1.7.5-1 (xorg-drivers xorg)         Synaptics driver for notebook touchpads     local/xf86-input-vmmouse 13.0.0-3 (xorg-drivers xorg)         X.org VMWare Mouse input driver     local/xf86-input-void 1.4.0-6 (xorg-drivers xorg)         X.org void input driver      Any idea how I can track down the responsible driver or in some other way disable the touch screen functionality?


title: How to 'free' a TCP port?

text: I have some code that listens to a specific TCP port. However, when I stop this code and restart it quickly afterwards, I see the error               ERROR: could not bind to socket on 0.0.0.0:7700      If I wait a minute or so, suddenly this port is 'free' and the code runs again. My question: Is there a way to force this particular port 'free'? To be able to start my code right away, without waiting a minute or so?


title: IPVS loadbalancer is not talking to realserver

text: I am trying to configure IPVS (IP Virtual Server) in Centos 6.3 and I have read http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.install.html and followed http://www.howtoforge.com/high_availability_loadbalanced_apache_cluster to setup and configure.


title: Creating a fixed-size post boot block device from ram

text: First off:               /root# cat /proc/version     Linux version 3.12.6      What I'm trying to do is create a block device (no filesystem) out of ram of a fixed (configurable) size (pre-allocated, not thin-provisioned) after boot of which I can pass the device to something like `mdadm`. I can't use `tmpfs` or `ramfs`, I needs a 'real' block device, also note that the buffer cache has been disabled


title: VNC server on Centos 6.4

text: I have a Centos Desktop VM installed in Virtualbox, and want to connect to it using VNC. I have tried to install vnc-server, but could not connect. I removed it, then tried tigervnc-server, but same problem. I thought this was a firewall problem, but after disabling the firewall I still can't connect. I followed this guide: http://www.unixmen.com/install-vnc/ The username is "john". I added an entry in /etc/sysconfig/vncservers:               VNCSERVERS="2:john"      When I connect from my Ubuntu desktop, I get the following error:               An error occurred - Connection to host 192.168.1.123 was closed.      I have no idea what is missing here. How can I configure this properly?


title: Extracting bigrams with sed

text: How do I split an entire text consisting of only letters into bigrams. For example: odd even               od -> de     dd -> ev      This is what I have so far but it does not produce the desired result.               [some source] | tail -n +30 | sed 's/[^A-Za-z\n]//g' | sed 's/\([A-Za-z]\)\([A-Za-z]\)\([A-Za-z]\)\([A-Za-z]\)\([A-Za-z]\)\{\0,1\}/\1\2 -> \3\4, \2\3 -> \4\5, /g' | sed 's/,/,\n/g'


title: How can I keep track of what's using the most CPU?

text: I use `nagios` to monitor my server. Once in a while I'll get a report that the CPU load is warning / critical, etc. Usually this happens at some odd hour or when I don't have the tools to immediately log in and look around. Is there some way that I can set up the system to take some `top` snapshots when the CPU usage is very high - either independently on the system or via `nagios`?


title: Methods to find out which (configuration) files are read by executable when started

text: What are the clever ways to find out which (configuration) files are read by executable if started? For example `snmpd` or `sshd`. One option is probably to check the `CONFIGURATION FILES` or `FILES` section on a manual page. The other one, which I thought will work, is to trace the system calls, but at least in case of `snmpd`, this does not seem to work:               root@vserver:~# strace 2>&1 /usr/sbin/snmpd | grep snmpd.conf     root@vserver:~#       Last but not least, `stat` command does not help either because file access time is not updated. If it was updated, one could get some indication of possible configuration files by executing `find /etc/ -type f -amin 1`. Any other ways to find out which (configuration) files are read by executable when started?


title: How to manage all logs on VPS

text: I'm new to Linux but I'm about to start using a VPS to host my website. I've been reading about and it's been mentioned that I need to make sure that all of my logs are rotating and compressed, but I don't understand how to do that. I'll be using Plesk but I understand that it will only cover a few logs, so how do I make sure that all my logs are rotated? And is there an easier way to view them than by using grep/cat?


title: Keyboard shortcuts not working in KDE 4.5.0

text: My printscreen button doesn't work (it doesn't launch ksnapshot, but xev registers it's events just fine). Does anyone have any idea how to fix it? Old workarounds don't seem to be working. **update** `~/.xsession-errors` has this in it...               kded(17569)/kdecore (KLibrary) kde4Factory: The library "/usr/lib/kde4/kded_khotkeys.so" does not offer a qt_plugin_instance function.     kded(17569)/kdecore (KLibrary) kde3Factory: The library "/usr/lib/kde4/kded_khotkeys.so" does not offer an "init_kded_khotkeys" function.     kded(17569) Kded::loadModule: Could not load library "kded_khotkeys" . [ "Cannot load library /usr/lib/kde4/kded_khotkeys.so: (/usr/lib/libknewstuff3.so.4: undefined symbol: _ZNK6Attica8Provider17hasContentServiceEv)" ]      systemsettings(18048)/khotkeys: Unable to start server org.kde.khotkeys (kded module)      kded(17569)/kdecore (KLibrary) kde4Factory: The library "/usr/lib/kde4/kded_khotkeys.so" does not offer a qt_plugin_instance function.     kded(17569)/kdecore (KLibrary) kde3Factory: The library "/usr/lib/kde4/kded_khotkeys.so" does not offer an "init_kded_khotkeys" function


title: Incorrect sorting according en_US.UTF-8

text: I'm seeing a weird behavior of the sort command when I sort by en_US.UTF-8. I'm trying to sort this file (LC_COLLATE=en_US.UTF-8 sort testdata): > 㐀 > > 㐃㐄 > > ▼▽◢ > > ㎏㎜㎝ > > ｂｑｚ > > ㄠㄨㄩ─┃┆ > > ◆□■△ > > ぁあぃい > > ┻╋┠┯┨ > > ꓃꓄꓆꒺꒻ > > 々—～‖…‘” > > 龷龸龹龺龻 > > ⺁⺄⺈⺋⺌⺗⺧⺪⺮⺳⺶⺷⺻⻊ > > mario > > david > > 且 > > 丁 > > 㐀丁 > > 㐂 > > 㐀且 > > 嗄 > > 阿 What happens is that the "mario" and "david" strings are sorted in the correct order, but the other characters are left in place. I would expect to see "david", "mario" and after them all the other strings. Is this the expected behavior?


title: Making an Android container with Ubuntu 12.04 on the Samsung ARM Chromebook : initrd file not found

text: I'm trying to run Android as guest OS with LXC containers on Ubuntu 12.04 LTS on the ARM Chromebook, reading this tutorial. At some point of the tutorial, it says: > Then get the `initrd` for your device and place it in > `/var/lib/lxc/android/initrd.gz` What does that mean? Do I have to rename `initrd` to `initrd.gz`? Where can I get the `initrd` file? It is not inside the Android container. Between the Android files I can see only these:               init     init.goldfish.rc     init.mahimahi.rc     init.rc


title: How to find a cron job if you know the specific time it runs?

text: I've been using kSar to look at my servers resource use. There is a definite spike in process creation at 4:04AM daily. Cron seems to define the interval they should be run, but not the specific time _**How can I find what cron job runs at that time?_**


title: apt: install packages downloaded previously

text: On Debian, I can download a package plus its dependent packages with               apt-get install my_desired_package --download-only      This will not install the packages, but only download them to `/var/cache/apt/archives/`. If I want to install the previously downloaded packages later, how would I do it (suppose I am offline)? I can install one package with `dpkg -l package1` but only if all dependencies are met.


title: Output order with process substitution

text: This is what I usually do to run `grep` and `wc` on a file without having to scan it twice               <file.txt  tee >(grep LITERAL) >(wc -l) >/dev/null      However, this yields               EXEC LITERAL     32      sometimes and               32     EXEC LITERAL      at other times. (The output from `grep` precedes the output from `wc` in the first instance and vice versa in the second.) On the other hand, with redirections and file descriptors               { { <file.txt tee /dev/fd/3 | grep LITERAL >&4; } 3>&1 | wc -l ;} 4>&1       I always seem to get               EXEC LITERAL     32      I prefer that the output order be predictable but is it guaranteed with the second approach?


title: How to have user directory for GNOME wallpapers

text: I have my wallpapers stored on Dropbox organized by dimensions and I would like to have them available to GNOME. However, I have found this is absurdely hard to do, as even complex searches on various engines render useless results. I can not have them stored on the global path (`/usr/share/backgrounds`) as this computer has a lot of users and they shouldn't be able to choose my wallpapers. Also, I would like to keep them stored on different directories for every dimension. I don't mind updating 5 or 6 lines if I add another directory. Where is the default path for users, if there is any, or how can I enable this and have my own wallpapers?


title: Dual-boot Ubuntu cannot access the Windows drive that it was installed on with wubi

text: I had Widonws with two drives C: and D:. In the drive C:, I have my Windows. In the drive D:, I had my all other files and data. I installed Ubuntu in the drive D:, without deleting any data from it. So when I boot my laptop,in boot menu I see both "Windows 7" and "Ubuntu". When I boot up with Ubuntu, it works well, but I don't have access my data in drive D: (where I installed Ubuntu) anymore. but when I boot up with Windows, I have access to it. Can anybody help me, how can I have access my data in drive D: from Ubuntu? this is some information.               sky@ubuntu:~$ sudo fdisk -l     [sudo] password for sky:           Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x2f56f4c5             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *    21585920    21790719      102400    7  HPFS/NTFS/exFAT     /dev/sda2        21790720   144670719    61440000    7  HPFS/NTFS/exFAT     /dev/sda3       144670782   625141759   240235489    f  W95 Ext'd (LBA)     /dev/sda5       144670784   562580234   208954725+   7  HPFS/NTFS/exFAT     /dev/sda6       562581504   617027583    27223040   83  Linux     /dev/sda7       617029632   625141759     4056064   82  Linux swap / Solaris               sky@ubuntu:~$ df     Filesystem     1K-blocks      Used Available Use% Mounted on     /dev/loop0      10698000   3015236   7116288  30% /     udev             1947220         4   1947216   1% /dev     tmpfs             782716       880    781836   1% /run     none                5120         0      5120   0% /run/lock     none             1956788       156   1956632   1% /run/shm     /dev/sda5      208954724 114865916  94088808  55% /host     sky@ubuntu:~$          sky@ubuntu:~$ cat /etc/fstab     # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc            /proc           proc    nodev,noexec,nosuid 0       0     /host/ubuntu/disks/root.disk /               ext4    loop,errors=remount-ro 0       1     /host/ubuntu/disks/swap.disk none            swap    loop,sw         0       0     sky@ubuntu:~$


title: Shell script to merge properties file (sed/awk/comm/diff) for rpm upgrade

text: We're developing a java product that's installed via rpm. We have a set of config files that a user can edit. These config files are java properties files in the form:               com.acme.pkg1.setting=something customized 1     com.acme.pkg2.setting=something original 2      These files are marked in the SPEC file with %config(noreplace), so after an upgrade, we could have an .rpmnew file next to it:               com.acme.pkg1.setting=something original 1     com.acme.pkg2.setting=something original 2     com.acme.pkg3.setting=something original 3      Is there a way to merge these files in such a way that only new keys are added to the original file? My idea was:   1. filter the keys    2. sort the keys    3. use comm(1), something like: comm -23 file.rpmnew.keys file.keys > new.keys    4. extract key=value from file.rpmnew matching new.keys   5. append result to original file How can we achieve all this in from an rpm post-update script? Preferably using only standard linux utilities (comm, diff, sed, awk, grep, ...)?


title: How to fix bad mirroring on AIX?

text: So mirroring is bad:               0:root@SERVER:/root # lslv -m hd2     hd2:/usr     LP    PP1  PV1               PP2  PV2               PP3  PV3     0001  0209 hdisk30           0322 hdisk32                0002  0210 hdisk30           0323 hdisk33                0003  0211 hdisk30           0323 hdisk32                0004  0212 hdisk30           0324 hdisk33                0005  0213 hdisk30           0324 hdisk32                0006  0214 hdisk30           0325 hdisk33                0007  0215 hdisk30           0325 hdisk32                0008  0216 hdisk30           0326 hdisk33                0009  0217 hdisk30           0326 hdisk32                0010  0218 hdisk30           0327 hdisk33                0011  0219 hdisk30           0327 hdisk32                0012  0220 hdisk30           0328 hdisk33                0013  0221 hdisk30           0328 hdisk32                0014  0222 hdisk30           0329 hdisk33                0015  0223 hdisk30           0329 hdisk32                0016  0224 hdisk30           0330 hdisk33                0017  0225 hdisk30           0330 hdisk32                0018  0226 hdisk30           0331 hdisk33                0019  0227 hdisk30           0331 hdisk32                0020  0228 hdisk30           0332 hdisk33                0021  0229 hdisk30           0332 hdisk32                0022  0230 hdisk30           0333 hdisk33                0023  0231 hdisk30           0333 hdisk32                0024  0355 hdisk30           0338 hdisk32                0025  0356 hdisk30           0339 hdisk32                0026  0357 hdisk30           0340 hdisk32                0027  0001 hdisk32           0307 hdisk8                 0028  0206 hdisk8            0305 hdisk43                0029  0207 hdisk8            0306 hdisk43                0:root@SERVER:/root #       How can I fix this? I know that it's just a few steps, but I can't google it :\ [break the mirror, then move the pp from the wrong this to a good one then then "unbreak" the mirror? how?] oslevel: 6100-05-01-1016 AIX


title: How can I setup Apache on Linux to stream WMV-HD to Xbox 360?

text: What I am looking for is a free and open source solution. If the distro I use matters, it is Open SUSE. VLC supports only WMV1&2\.


title: Storing Web Session on S3 bucket

text: I have a cluster of web servers which store web session related information in a NFS shared directory. We are trying to implement an AWS version of our product where we could use S3 bucket to store static contents. I now need to store the web sessions on a shared location which all the ec2 webservers can share. As it has been explained here http://harish11g.blogspot.co.uk/2012/10/web-session-synchronization-aws- ec2.html, Amazon's Elasticache would be one of the best option to store we b session but it would require some code changes. This is not too much of problem. I am trying to find out what is the best option without changing too much. Could the S3 buckets be used for storing web sessions? Would there be any issue with latency? Applications are written in PHP4 and PHP5.


title: RHEL6 LUKS with TPM support?

text: I'm surprised that this question is not asked more frequently, but (in RHEL) does LUKS support TPM's the way that Windows BitLocker does? If so, how is this feature implemented, and does it provide the same type of protections that BitLocker for Windows provides? BitLocker is very popular among businesses, and now that RHEL6 is getting FIPS certification for the disk encryption modules, it would be great if it also supported the same feature set. However, I do understand that with the way LUKS works, not every volume can be encrypted, since the system would need to read the `/etc/fstab` and the `/etc/crypttab` files in order to mount the volumes. I believe this is OK as long as `/home`, `/var`, and other directories chosen by the administrator are encrypted. _I find it odd that "TPM" is not a tag on serverfault._


title: printing issue: single page on PC is printing across multiple pages

text: I have just setup a ubuntu 11.10 desktop and i have an issue with the printing. When I send a document from the desktop to the HP Officejet 6500 E710n-z it will center it and print across 4 pages.               -------------     |      |     |     |      |     |     |     A|B    |     |------|-----|     |     C|D    |     |      |     |     |      |     |     --------------      Does anyone have any suggestions?


title: List of useful `less` functions

text: Rather than ask for your favorite, lets just list them off. What are the more useful commands inside `less`? Personally, I use:   * `/` (search forward)   * `?` (search backwards)    * `F` (enable tail -f like behvaior, Ctrl-C to break out of it)    * `v` (open file in $EDITOR for editing, defaults to vi/vim) Others?


title: How to write makefile for bulk processing?

text: I have some files in a folder `source`. I want to process them using program `program` and output them into folder `target` just by typing               $ make      How should I write a makefile for this? Directory tree:               /         Makefile         program        /source           foo.x           bar.x           spam.x        /target           foo.y           bar.y           spam.y


title: Tunnel incoming rtorrent connections to rtorrent

text: I'm running rtorrent on a seedbox, but this seedbox has significant bandwidth restrictions. I have another server (I'll call it the proxy) with no bandwidth restrictions which I'd like to use as a proxy when leechers are connecting to my box (the connection between the seedbox and the proxy has no bandwidth restrictions). There are a few ways I could see this working out, but I'm not sure on the details (mainly I'm unsure of how to coax rtorrent into doing what I want):   * ssh from the seedbox into the proxy, reverse forwarding the incoming connections port to localhost. The problem is: how do I get rtorrent to tell peers that they should connect to the proxy and not to the seedbox directly?   * ssh from the seedbox into the proxy, set up a SOCKS tunnel, and wrap all rtorrent traffic in the tunnel. This is feasible, but I'd like to avoid the hackiness of force-tunneling rtorrent connections without rtorrent knowing what's going on (per this answer, I'd likely have to do it without rtorrent's knowledge). Any ideas?


title: Display column that has a specific string

text: Content of a sample file is as follow:               AA BB CC DD BB     1  2  3  4  9     5  6  7  8  10      I want to display the whole columns that contain `BB` and `DD`. In the real case, I do not know which columns contain the strings `BB` and `DD`. And additionally, it will be great to determine order of the columns that will be printed. The desired output is:               BB DD BB     2  4  9     6  8  10      When it is said that `DD` column must be first, the desired output is:               DD BB BB     4  2  9     8  6  10      Column ordering may given in a string e.g. `cols="BB, DD"`. Delimiter of the input file may change.


title: Daemon - how to tell the start daemon to execute this daemon as different username then root?

text: I have this startup script, when i launch i have the execution done by username: root, instead of username: sun. How can i tell the `start_daemon` to execute it as username : sun not root?               $ ps aux | grep python     root       950  0.1  0.2 171132 18936 ?        S    05:35   0:00 /usr/bin/python /var/tmp/mp.py          root@nson:/etc/rc0.d# cat K20mp      #! /bin/sh     PATH=/bin:/usr/bin:/sbin:/usr/sbin     DAEMON=/var/tmp/mp.sh     PIDFILE=/var/run/mp.pid          test -x $DAEMON || exit 0          . /lib/lsb/init-functions          case "$1" in       start)          log_daemon_msg "Starting mp"          start_daemon -p $PIDFILE $DAEMON --user sun --chuid sun          log_end_msg $?        ;;       stop)          log_daemon_msg "Stopping mp"          killproc -p $PIDFILE $DAEMON          PID=`ps x |grep mp.py | head -1 | awk '{print $1}'`          kill -9 $PID                 log_end_msg $?        ;;       force-reload|restart)          $0 stop          $0 start        ;;       status)          status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $?        ;;      *)        echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload|status}"        exit 1       ;;     esac     exit 0      EDIT: Reference not working http://man.he.net/man8/start-stop-daemon http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core- generic/iniscrptfunc.html


title: MySQL socket and PHP (and other languages)

text: **Background info** I'm currently running CentOS (or Red Hat?). `uname -a` gives (I edited out my domain name)               Linux XXXXXXXXX.com 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux      `cat /etc/issue` gives               CentOS release 6.2 (Final)     Kernel \r on an \m      and `cat /proc/version' gives               Linux version 2.6.32-71.29.1.el6.x86_64 (mockbuild@c6b5.bsys.dev.centos.org) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Mon Jun 27 19:49:27 BST 2011      `php --version` gives               PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)      Copyright (c) 1997-2010 The PHP Group     Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies      `mysql --version` gives               mysql  Ver 14.14 Distrib 5.5.20, for Linux (x86_64) using readline 5.1      `python --version` gives               Python 2.7.2      I also know python is 64-bit because `math.log( sys.maxsize, 2 ) + 1` returns `64`. Originally I believe PHP could communicate with MySQL when I installed MySQL over `yum`, but that is version 5.1 and I wanted 5.5 (better InnoDB features). So I uninstalled MySQL 5.1 with `yum` then manually installed 5.5 using most of this guide. I can enter the MySQL monitor (CLI tool) and do everything such as create databases and tables and enter queries. **Problem** But when I try to interact MySQL with PHP. I get the following error:               Not connected : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)      During the installation of MySQLdb for Python, I get this error message:               root@XXXXXXXXX:/usr/local/MySQL-python-1.2.3# python setup.py build     running build     running build_py     copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb     running build_ext     building '_mysql' extension     gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/local/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -m64 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1     In file included from _mysql.c:36:     /usr/include/mysql/my_config.h:422:1: warning: "HAVE_WCSCOLL" redefined     In file included from /usr/local/include/python2.7/Python.h:8,                      from pymemcompat.h:10,                      from _mysql.c:29:     /usr/local/include/python2.7/pyconfig.h:887:1: warning: this is the location of the previous definition     gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -lmysqlclient_r -lpthread -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so     /usr/bin/ld: cannot find -lmysqlclient_r     collect2: ld returned 1 exit status     error: command 'gcc' failed with exit status 1      **Possible useful info** Part of `/etc/my.cnf` reads               # The following options will be passed to all MySQL clients     [client]     #password   = your_password     port        = 3306     socket      = /var/lib/mysql/mysql.sock          # Here follows entries for some specific programs          # The MySQL server     [mysqld]     port        = 3306     socket      = /var/lib/mysql/mysql.sock     skip-external-locking     key_buffer_size = 256M     max_allowed_packet = 1M     table_open_cache = 256      sort_buffer_size = 1M     read_buffer_size = 1M     read_rnd_buffer_size = 4M     myisam_sort_buffer_size = 64M      thread_cache_size = 8      query_cache_size= 16M      # Try number of CPU's*2 for thread_concurrency     thread_concurrency = 8      Part of `/etc/php.ini` reads               [MySQL]     ; Allow or prevent persistent links.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.allow-persistent     mysql.allow_persistent = On          ; Maximum number of persistent links.  -1 means no limit.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-persistent     mysql.max_persistent = -1          ; Maximum number of links (persistent + non-persistent).  -1 means no limit.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-links     mysql.max_links = -1          ; Default port number for mysql_connect().  If unset, mysql_connect() will use     ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the     ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look     ; at MYSQL_PORT.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-port     mysql.default_port =          ; Default socket name for local MySQL connects.  If empty, uses the built-in          ; MySQL defaults.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-socket     mysql.default_socket = /var/lib/mysql/mysql.sock          ; Default host for mysql_connect() (doesn't apply in safe mode).     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-host     mysql.default_host =          ; Default user for mysql_connect() (doesn't apply in safe mode).     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-user     mysql.default_user =          ; Default password for mysql_connect() (doesn't apply in safe mode).     ; Note that this is generally a *bad* idea to store passwords in this file.     ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")     ; and reveal this password!  And of course, any users with read access to this     ; file will be able to reveal the password as well.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-password     mysql.default_password =          ; Maximum time (in seconds) for connect timeout. -1 means no limit     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.connect-timeout     mysql.connect_timeout = 60          ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and     ; SQL-Errors will be displayed.     ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.trace-mode     mysql.trace_mode = Off      Both the `my.cnf` and `php.ini` read `/var/lib/mysql/mysql.sock`. What is wrong with my configuration?? Thanks in advance for reading this long post! **Edit** Here are some new information: `/var/lib/mysql` shows the following content (once again I X'ed out my domain name):               total 29M     drwx------   6 mysql 4.0K Feb  2 13:25 ./     drwxr-xr-x. 52 root  4.0K Sep 23 07:50 ../     -rw-rw----   1 mysql  18M Feb  2 15:04 ibdata1     -rw-rw----   1 mysql 5.0M Feb  2 15:04 ib_logfile0     -rw-rw----   1 mysql 5.0M Feb  2 12:03 ib_logfile1     drwx------   2 mysql 4.0K Feb  2 15:04 mapshare/     drwx------   2 mysql 4.0K Feb  2 11:20 mysql/     -rw-rw----   1 mysql  906 Feb  2 12:58 mysql-bin.000001     -rw-rw----   1 mysql 1.9K Feb  2 15:04 mysql-bin.000002     -rw-rw----   1 mysql   38 Feb  2 12:59 mysql-bin.index     srwxrwxrwx   1 mysql    0 Feb  2 12:59 mysql.sock     drwx------   2 mysql 4.0K Feb  2 11:20 performance_schema/     -rw-r--r--   1 mysql  678 Feb  2 12:01 RPM_UPGRADE_HISTORY     -rw-r--r--   1 mysql  339 Feb  2 12:01 RPM_UPGRADE_MARKER-LAST     -rw-rw----   1 mysql 3.0K Feb  2 12:59 XXXXXXXXXX.err     -rw-rw----   1 mysql    6 Feb  2 12:59 XXXXXXXXXX.pid     drwx------   2 mysql 4.0K Feb  2 13:35 scoutmob/      `show variables like 'socket';` gives               +---------------+---------------------------+     | Variable_name | Value                     |     +---------------+---------------------------+     | socket        | /var/lib/mysql/mysql.sock |     +---------------+---------------------------+     1 row in set (0.00 sec)      `which gcc` gives               /usr/bin/gcc      `gcc --version` gives               gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)     Copyright (C) 2010 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      `find / -name libmysqlclient_r.* 2>/dev/null` gives               /usr/lib64/mysql/libmysqlclient_r.so.16     /usr/lib64/mysql/libmysqlclient_r.so.16.0.0     /usr/lib64/mysql/libmysqlclient_r.a      So this looks like MySQLdb was looking in the wrong path (`lib` instead of `lib64`)?


title: How to find all the links to a directory

text: When I stat a directory I get a listing that tell me there are 5 links to the directory.               stat dir      My question is how do I get information (names and locations) to all these 5 links?


title: Is there an equivalent of calling the built-in python function help('topics') but in bash?

text: I would like to explore man pages in bash using something similar to the python help('topics') function. Does this exist in bash? I know the bash equivalent of python's help('modules') would look something like:               dpkg –get-selection


title: illegal seek,system call

text: here is my test_code: ![enter image description here](http://i.stack.imgur.com/J1cvF.jpg) ![enter image description here](http://i.stack.imgur.com/f9hka.jpg) And,when i run it,it prompt: ![enter image description here](http://i.stack.imgur.com/SAgEW.jpg) Anyone can show me why?thx


title: Why slowusb and scandelay?

text: I'm running linux-3.4.9 compiled with genkernel, and booting from a USB HDD. I was slightly annoyed by the slow boot process, in particular, during the execution of genkernel scripts at the modprobe & mdev stage. So after having loaded the modules, it seems to wait a fixed amount of time for the devices to initialize. Is there a deep reason for that? Why not just wait until the specific root device becomes available? Or is my understanding of the situation totally incorrect?


title: find which system is transmitting through a particular port

text: I am using command `nc -lu <port no.>` to find on given port any data is receiving or not. I am getting data if there is transmission going on (but don't know from where!). Is there any way that should provide me the transmitters IP address??   `wireshark` and `nmap` are there, but I want a shorter way, if possible.   **UPDATED:** I think `nc -luv` is what I want, But at a time it is showing only one IP. I want to know if more than one system is transmitting through that port??


I used the inbuilt VNC-Viewer in the virt-manager to see the VM desktops. But now when I click the Play button in the VM Window to see the desktop of the VM named `server1.example.com`, I get an error message like below:               Error : Viewer Connection to hypervisor host got refused     or disconnected!      Below is my configuration from `/etc/libvirt/qemu/server1.example.com`               <!--     WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE     OVERWRITTEN AND LOST. Changes to this xml configuration should be made           using: virsh edit server1.example.com or other application using the      libvirt API.     -->          <domain type='kvm'>     <name>server1.example.com</name>     <uuid>ca13796e-5917-bff4-b4ca-1203f660cbb2</uuid>     <memory unit='KiB'>1048576</memory>     <currentMemory unit='KiB'>1048576</currentMemory>     <vcpu placement='static'>1</vcpu>     <os>     <type arch='x86_64' machine='rhel6.4.0'>hvm</type>     <boot dev='hd'/>     </os>     <features>     <acpi/>     <apic/>     <pae/>     </features>     <clock offset='utc'/>     <on_poweroff>destroy</on_poweroff>     <on_reboot>restart</on_reboot>     <on_crash>restart</on_crash>     <devices>     <emulator>/usr/libexec/qemu-kvm</emulator>     <disk type='file' device='disk'>       <driver name='qemu' type='raw' cache='none'/>       <source file='/var/lib/libvirt/images/server1.example.com.img'/>       <target dev='hda' bus='ide'/>       <address type='drive' controller='0' bus='0' target='0' unit='0'/>     </disk>     <disk type='block' device='cdrom'>       <driver name='qemu' type='raw'/>       <target dev='hdc' bus='ide'/>       <readonly/>       <address type='drive' controller='0' bus='1' target='0' unit='0'/>     </disk>     <controller type='usb' index='0'>     </controller>     <controller type='ide' index='0'>       <address type='pci' domain='0x0000' bus='0x00' slot='0x01'          function='0x1'/>     </controller>     <interface type='network'>       <mac address='52:54:00:e1:ba:1e'/>       <source network='default'/>       <address type='pci' domain='0x0000' bus='0x00' slot='0x03'           function='0x0'/>     </interface>     <serial type='pty'>       <target port='0'/>     </serial>     <console type='pty'>       <target type='serial' port='0'/>     </console>     <input type='mouse' bus='ps2'/>     <graphics type='vnc' port='5901' autoport='no' listen='127.0.0.1'>       <listen type='address' address='127.0.0.1'/>     </graphics>      I had a bad feeling about my iptables rules, so I have decided to add /etc/sysconfig/iptables file. Please see below.               # Firewall configuration written by system-config-firewall     # Manual customization of this file is not recommended.     *filter     :INPUT DROP [0:0]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [0:0]     -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     -A INPUT -p icmp -j ACCEPT     #-A INPUT -i lo -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 23 -j  ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 5903 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 5904 -j ACCEPT     -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT     -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT     -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT     -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT     -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 5903 -j ACCEPT     -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 5904 -j ACCEPT     -A FORWARD -m state --state NEW -i wlan0 -o vibr0 -j ACCEPT     -A FORWARD -m state --state NEW -i vibr0 -o wlan0 -j ACCEPT     -A INPUT -j REJECT --reject-with icmp-host-prohibited     -A FORWARD -j REJECT --reject-with icmp-host-prohibited     COMMIT      Below are the virtualization packages on my system :               libvirt.x86_64           0.10.2-18.el6                     @localrepo     libvirt-client.x86_64    0.10.2-18.el6                     @localrepo     libvirt-python.x86_64    0.10.2-18.el6                     @localrepo     python-virtinst.noarch   0.600.0-15.el6                    @localrepo     virt-manager.x86_64      0.9.0-18.el6                      @localrepo     virt-what.x86_64         1.11-1.2.el6                      @base/6       I have tried viewing the VM desktop using the tiger-vnc and that was a success.   Can somebody suggest a method to resolve this issue? **Part added after the edit** : Surpisingly the virt-viewer command works fine, Also the remote-desktop-viewer (vinagre) does the job.               [ssam@centos ~]$ virt-viewer --debug -c qemu:///system 2     ** (virt-viewer:7930): DEBUG: Insert window 0 0x1a25890     ** (virt-viewer:7930): DEBUG: fullscreen display 0: 0     ** (virt-viewer:7930): DEBUG: fullscreen display 0: 0     ** (virt-viewer:7930): DEBUG: Opening connection to libvirt with URI         qemu:///system     ** (virt-viewer:7930): DEBUG: Add handle 7 1 0x1a8d5c0     ** (virt-viewer:7930): DEBUG: notebook show status 0x1a24190     ** (virt-viewer:7930): DEBUG: notebook show status 0x1a24190     ** (virt-viewer:7930): DEBUG: Guest 2 is running, determining display     ** (virt-viewer:7930): DEBUG: Set connect info: (null),(null),(null),-1,        (null),(null),(null),0     ** (virt-viewer:7930): DEBUG: Guest 2 has a vnc display     ** (virt-viewer:7930): DEBUG: Guest graphics address is 127.0.0.1:5901     ** (virt-viewer:7930): DEBUG: Set connect info: localhost,127.0.0.1,5901,-1,        (null),(null),(null),0     ** (virt-viewer:7930): DEBUG: Error operation virDomainOpenGraphics          forbidden for read only access     ** (virt-viewer:7930): DEBUG: After open connection callback fd=-1     ** (virt-viewer:7930): DEBUG: Opening direct TCP connection to display at         127.0.0.1:5901:-1     ** (virt-viewer:7930): DEBUG: notebook show status 0x1a24190     ** (virt-viewer:7930): DEBUG: Add timeout 0x1a9abf0 -1 0x3ee80aa2b0         0x1a8d900 1     ** (virt-viewer:7930): DEBUG: notebook show status 0x1a24190     ** (virt-viewer:7930): DEBUG: notebook show display 0x1a24190     ** (virt-viewer:7930): DEBUG: Display size request 100x100 (desktop 100x100)     ** (virt-viewer:7930): DEBUG: Allocated 400x375     ** (virt-viewer:7930): DEBUG: Child allocate 375x375     ** (virt-viewer:7930): DEBUG: desktop resize 1024x768     ** (virt-viewer:7930): DEBUG: Preparing main window resize     ** (virt-viewer:7930): DEBUG: Decided todo 1024x768 (desktop is 1024x768,        fullscreen is 1280x800     ** (virt-viewer:7930): DEBUG: Display size request 1024x768 (desktop         1024x768)     ** (virt-viewer:7930): DEBUG: Allocated 1024x768     ** (virt-viewer:7930): DEBUG: Child allocate 1024x768     ** (virt-viewer:7930): DEBUG: Display size request 50x50 (desktop 1024x768)     ** (virt-viewer:7930): DEBUG: Allocated 1024x768     ** (virt-viewer:7930): DEBUG: Child allocate 1024x768     ** (virt-viewer:7930): DEBUG: Dispatch handler 7 1 0x1a8d5c0     ** (virt-viewer:7930): DEBUG: Dispatch handler 7 2 0x1a8d5c0     ** (virt-viewer:7930): DEBUG: Dispatch handler 7 1 0x1a8d5c0


title: "rm -rf Filename.iso " Permission denied

text: Hi I am facing an issue while deleting an .iso file from `Linux x86_64 GNU/Linux`. Here are the permissions for the file:                   # ls -lrt         -rwxrwxr-x 1 dev devgrp 2687934464 Apr 12 14:13 FileName.iso*      Here is the error I am getting:                   # rm -f FilsName.iso         rm: cannot remove `FileName.iso': Permission denied      How to resolve this Permission denied error? I am logged in as `root` user. * * * EDIT               $ lsattr     lsattr: Inappropriate ioctl for device While reading flags on ./FileName.02.md5     lsattr: Inappropriate ioctl for device While reading flags on ./FileName.02.iso     lsattr: Inappropriate ioctl for device While reading flags on ./FileName.03.md5     lsattr: Inappropriate ioctl for device While reading flags on ./FileName.03.iso     lsattr: Inappropriate ioctl for device While reading flags on ./FileName.04.iso      * * * Strange issuse for me I can delete/move other files except `FileName.04.iso`.


title: Why do some Linux files have a 'd' suffix?

text: I am new to Linux. I observed some of the binary files and configuration file name s end with a `d`. What is reason for putting a `d` at the end of the file name? Like `httpd`, `ospfd`, `pppd`, `syslogd`, `telnetd`, `pptpd`, and `dhcpd`.


title: How do I enable a three column layout in XMonad?

text: I'm a Haskell and XMonad beginner. I'm trying to set up my tiling layout to allow three side by side columns (so that I can have three simultaneous tall and thin Vim instances for coding, per workspace). In the docs, I've found a three-column layout function, and even managed to import it and define a custom layout, but I'm not sure how to add it to my `layoutHook`, which already has some stuff defined from a tutorial I read, to keep my `xmobar` safe from window covering. The relevant lines of my `xmonad.hs`:               import XMonad.Layout.ThreeColumns     threeLayout = ThreeCol 1 (3/100) (1/2)     ...     main = do         xmonad $ defaultConfig         { manageHook = manageDocks <+> manageHook defaultConfig         , layoutHook = avoidStruts $ layoutHook defaultConfig         ...      So this is basically a noob syntax question. How do I change the `layoutHook` line to keep the existing configs, while also adding my three-column tile layout?


title: What's the reason for this specific "rm" sequence in the xkcd joke?

text: Here's part of this xkcd comic strip where the idea is that the author can't write a sort program so he adds code to delete all files               system("rm -rf ./");     system("rm -rf ~/*");     system("rm -rf /");      AFAIK the canonical way to delete everything is to `rm` `/` so that everything starting from root is deleted. Here this is the last command and the two commands before that try to `rm` the current directory and the contents of the home directory. Why not just `rm` `/`?


title: Slackware Console Resolution when Dual Booting with Another Distro's GRUB2?

text: I am tweaking my new Linux Installs on a new home-built machine. I installed Linux Mint 14 first followed by Slackware 14 and Arch Linux on separate partitions. I don't think it matters, but the machine (AMD A10 CPU with an A75 chipset MSI motherboard) is UEFI (and secure boot) capable but I am running it in Legacy BIOS mode, since I have not wrapped my brain around this whole UEFI thing. The 3TB hard drive is however partitioned using a GUID partition scheme (without an EFI partiton), though none of the partitions is greater than 2 TB (the largest partition on that drive is 1 TB). I have already spent a couple of evenings tweaking the installs and would rather leave them as is. After wrestling with it several times, I have managed to get `os-prober` and `GRUB2` to recognize the existance of the Slackware and Arch Linux partitons and to boot them correctly. The auto-genetated `/boot/grub/grub.cfg` file is a fairly elaborate (and frightening) affair with elaborate shell scripting including if-else scripts etc. It is beyond my level of comfort with editing GRUB and LILO config files (I can handle manual editing of a simple LILO or Legacy GRUB script). After this lengthy introduction my question is this: I intend to use Slackware and Arch mainly from the command line. The console font and resolution on my 24 inch screen is a low resolution chunky affair and I would prefer to adjust the console resolution. I know how to do it to some extent using `LILO` in Slackware (even then it is a little unpredictable) but am now relying on Linux Mint's `GRUB2` as the boot loader for the 3 distros (will also add Scientific Linux later). How do I adjust the console resolution for Slackware and Arch (preferably independently) within GRUB2 installed from within Linux Mint?


title: Linux User not able to login

text: I am trying to create new users using `useradd` command using root credentials it is getting created properly but when I log in with the newly created user with its credentials using a PuTTY Console, I am able to enter the username but when I give the password, it hangs there for a long time until the PuTTY window session timeout happens and the window is closed. However when I use root credentials, it quickly enters the session. I tried checking the `AllowUsers` under file `/etc/ssh/sshd_config` but I didn't find any matching entry, so, I manually tried adding `AllowUsers temipuser` where `temipuser` is the username I created. Post making this change from another PuTTY Console I again tried entering this username but it is again the same. I am totally clueless why is this happening. Another thing is, if I add any user, say just `temipuser`, to the `AllowUsers` entry in the `sshd_config` file, will the root user still have access or will it not get access? I don't want to screw the things here. I understand `AllowUsers` lets only the specified users and denies others.


title: Cannot resolve hostname

text: I'm using a Debian on a RaspberryPi and the problem that I'm having is that I can't connect to the Internet. Every time I try I see a message that says "cannot resolve hostname". From the terminal, I tried:               $ ping www.google.com      unknown host google.com          $ ping 8.8.8.8     network is unreachable      output of 'ip addr list'               1: <LOOPBACK, UP, LOWER_UP> mt 65536 qdisc noqueue state UNKNOWN        link/loopback 00:00:00:00:00:00 vrd 00:00:00:00:00:00:        inet 127.0.0.1/8 scope host lo           valid_lft forever preferred_lft forever          2: eth0: <BOADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 dis pfifo_fast state UP qlen 100        link/ether b8:27:eb:18:b9:17 brd ff:ff:ff:ff:ff:ff      This appears after doing the ifdown eth0 and ifup eth0 as drobert suggest                 innet 1393.182.112.9116 brd 139.182.255.255 scope global eth0         valid_lft forevere preferred_lft forever      ip route ls               139.182.0.0/16 dev eth0 proto kernel scope link src 139.182.112.9      etc/network/interface               auto lo          iface lo inet loopback     iface eth0 inet dhcp          address 139.182.112.9          allow-hotplug wlan0     iface wlan0 inet manual     wpa-roam /etc/wpa_supplicant/wpa_supplicant.cong     iface default inet dhcp      ifconfig               bcast: 139.182.255.255     Mask: 255.255.0.0      I try the up route list command nothing happed


title: Centos 6.3 Server ignoring IGMP Queries

text: I am using a CentOS 6.3 server to subscribe to UDP multicast data, and I noticed that my server doesn't answer the IGMP queries sent by the switch it is connected to. As a result, when I open my multicast socket, I start receiving multicast data, but this stops when my IGMP subscription times out. The server doesn't renew its IGMP subscriptions, so the switch cuts off the multicast stream. (To insure that the problem doesn't come from any code of mine, I am using `smcroute` to open multicast subscriptions.) Here is a screenshot of the IGMP communications on any interface of my server: http://img521.imageshack.us/img521/9953/capture10y.png As we can see, my server first sends 2 IGMP joins, but a few minutes later when the switch sends the IGMP group membership query, the kernel doesn't answer. The version of the IGMP protocol set for the affected interface is V2:               [root@localhost ~]# cat /proc/net/igmp     Idx Device    : Count Querier   Group    Users Timer    Reporter     1   lo        :     0      V2                     010000E0     1 0:00000000       0     2   eth0      :     5      V2                     FB0000E0     1 0:00000000       1                     010000E0     1 0:00000000       0     5   tap0      :     5      V3                     FB0000E0     1 0:00000000       0                 010000E0     1 0:00000000       0     7   eth1.371:    13      V2                 414000E0     1 0:00000000       1                 404000E0     1 0:00000000       1                 3F4000E0     1 0:00000000       1                 504000E0     1 0:00000000       1                 524000E0     1 0:00000000       1                 494000E0     1 0:00000000       1                 4A4000E0     1 0:00000000       1                 4B4000E0     1 0:00000000       1                 FB0000E0     1 0:00000000       0                 010000E0     1 0:00000000       0      The `rp_filter` is disabled on this interface:               [root@localhost ~]# cat /proc/sys/net/ipv4/conf/eth1.371/rp_filter      0


title: How to find out the file offset of an opened file?

text: My problem is that with `lsof -p pid` I can find out the list of opened file of a process whose process id is pid. But is there a way to find out the file offset of each accessed file ? Please give me some suggestions ?


title: File size limit exceeded in bash

text: I have tried this shell script on a SUSE 10 server, kernel 2.6.16.60, ext3 filesystem. The script has a line like this:               cat file | awk '{print $1" "$2" "$3}' | sort -n > result      The file's size is about 3.2G, and I get the following error message: `File size limit exceeded`. In this shell, `ulimit -f` is unlimited. After I change script into this:               cat file | awk '{print $1" "$2" "$3}' >tmp     sort -n tmp > result      the problem is gone. I don't know why, can anyone help me with an explanation?


title: Why am I getting an error: "Failed to open '/dev/st0'" when extracting an archive with bsdtar?

text: I installed `bsdtar` from source (from the libarchive website) because I could not find an `rpm` nor a package in `yum`. I'm able to see `bsdtar`'s help message. For example:               $ bsdtar --help     First option must be a mode specifier:       -c Create  -r Add/Replace  -t List  -u Update  -x Extract     Common Options:     ...     bsdtar 3.1.2 - libarchive 3.1.2      But when I try to extract a file, I get the following error:               $ bsdtar -xzC . < archive.tar.gz     bsdtar: Error opening archive: Failed to open '/dev/st0'      How do I fix this error?


title: Use system clipboard in vi-copy mode in tmux

text: I'm running tmux 1.6 and I'm trying to configure it to use vi-style keybindings as well as use the system clipboard when copying in interactive mode:               set-window-option -g mode-keys vi          bind-key -t vi-copy 'v' begin-selection     bind-key -t vi-copy 'y' "copy-selection && run \"tmux save-buffer | xclip -selection clipboard\""      Simply put, I'd like to be able to do `C`+`[` and then use `v` to begin selecting text for copying, then when `y` is pushed, copy the selection to the tmux selection and then export it to the system clipboard using `xclip`. Unfortunately, when I try to do this, I see the following:               .tmux.conf: 14: unknown command: copy-selection && run "tmux save-buffer | xclip -selection clipboard"      Is there a way to do this in tmux configuration?


title: Host name on terminal changes when I connect internet : why?

text: [acme@localhost ~]$ su     Password:      [root@localhost acme]#       Now I connect internet and I get the following:               [root@localhost acme]# exit     exit     [root@localhost acme]# su     [root@dhcppc9 acme]#        **Edit**               [root@dhcppc9 lin64]# echo $PS1     [\u@\h \W]\$      **I observed that it is hapnning in user also not just when I am in superuser.** Why this dhcppc9 is coming ? OS: RHEL 6


title: Silently start task in background

text: I know that you can use this to start a process in the background, without getting the notification when the process is put in the background and when it is done like so:               (command &) &> /dev/null      However this removes the option to trap when the process finishes (`trap child_done CHLD`). How can I have both?


title: zsh prompt not escaped properly

text: This is my current prompt definition:               PROMPT='%(?..%F{red}%?%f:)%F{blue}%n%f:%F{green}%{${PWD/#$HOME/~}%} %(!.%F{red}.%f)%# %f'      The cursor sometimes starts one character behind the actual prompt, for example when searching the history using `ctrl``R`.


title: Can't cat a file or make a directory: contradictory output?

text: I am getting output from a terminal in Ubuntu 12 that I don't understand.               $cat sublime     no such file or directory          $mkdir sublime     cannot create directory 'sublime': File exists      How can both of these be true? I am trying to install sublime text with these instructions but having trouble making a symbolic link because /usr/bin/sublime does not exist.


title: Search Alt+F2 history

text: I wonder if there's some way to search the Alt+F2 "runner" history most preferably within the dialog itself. I know that in Cinnamon the values are available in `dconf-editor` under `org.cinnamon command-history` but I'm not sure how to take advantage of this knowledge Currently on Linux Mint 15 if that matters. **EDIT:** To be clear, I know that I can cycle through history with Up and Down arrow. I'm looking for a way to quickly find a command I might have run months ago.


title: How to map iscsi device to /dev/sdX

text: I have an initiator (Debian 7) connected to two targets. Each target provide multiple iscsi devices. On the initiator, iscsi devices are mapped randomly to /dev/sdx, for example :               target1-iscsi1 -> /dev/sdb     target1-iscsi2 -> /dev/sdc     target2-iscsi1 -> /dev/sdd     target1-iscsi3 -> /dev/sde     target2-iscsi2 -> /dev/sdf      I would like to re-map isci devices to have a more "logical" mapping such as :               target1-iscsi1 -> /dev/sdb     target1-iscsi2 -> /dev/sdc     target1-iscsi3 -> /dev/sdd     target2-iscsi1 -> /dev/sde     target2-iscsi2 -> /dev/sdf      How can I achieve that?


title: Safely using a hard drive dock

text: I just pick up an Ez-Dock HD dock 2535. It came with sparse instructions ( and as usual Windows centric ). Software wise ie mounting, syncing,unmounting is not a problem. Hardware wise though I am uncertain of what order I can do things and be safe. This particular dock comes with a USB port ( eSata too but I won't be using it ), power supply, power button, sata power and data. Oh and a "one touch backup" button. So under what circumstances can I use this without causing damage? For example can I place a drive in the dock while power is on and the USB is connected? What removing a drive. Is it OK to power this thing off while the USB is connnected? I would appreciate it if people described all possible circumstances.


title: Is Gobolinux active any more?

text: Today I hear about existence of a revolutionary distro named Gobolinux. I am very interested and excited about it (in particular its file structure). Unfortunately it is not updated for a while. Does anybody have some info about its state? Is it a live project? Is it safe to use it? Is there any other distro that uses a similar file structure?


title: Is there a tool that combines zcat and cat transparently?

text: When handling log files, some end up as gzipped files thanks to `logrotate` and others not. So when you try something like this:               $ zcat *      you end up with a command line like `zcat xyz.log xyz.log.1 xyz.log.2.gz xyz.log.3.gz` and then with:               gzip: xyz.log: not in gzip format      Is there a tool that will take the magic bytes, similar to how `file` works, and use `zcat` or `cat` depending on the outcome so that I can pipe the output to `grep` for example? NB: I know I can script it, but I am asking whether there is a tool out there already.


title: should I fix "No ALTQ support in kernel" to run the firewall?

text: I just messed with my `pf.conf` and ran `pf` and I got:               Enabling pf.     No ALTQ support in kernel      Of course the fix is to re-compile the kernel, but that article is for freebsd 7. I'm on **FreeBSD 9.1** I want to know:   1. Should I really bother to enable ALTQ and recompile? Do I need to do it to re-route traffic into and outside my freebsd jail?   2. Does the fix in this article apply to FreeBSD 9.1, I don't want to spend all night building the OS only to found out at the end something went wrong!!


title: For all files that does not contain a string, prepend a string to the file

text: I am trying to iterate through a list of html files, check to see if `{% load static from staticfiles %}` exists in the file and **if it does not exists** , prepend `{% load static from staticfiles %}` to it. This is what I have now on 1 file called `job/home.html` (for testing purposes before applying it to all files): `grep -q '{% load static from staticfiles %}' job/home.html || sed -i '' 's+{% load static from staticfiles %}\n+' job/home.html` So 2 things,   * How can I make this command recursive for all the html files   * The line break, `\n` doesn't seem to be line breaking


title: How do I fill my password automatically from .bash_profile when running command as sudo?

text: I know I could just put something like `sudo mypassword` in my `.bash_profile`, but I don't want to run every command as root. I want password to autofill under following circumstances:   * only the commands requiring root privileges   * only commands that I explicitly state I plan to run su to root with `sudo` Example:               sudo cd /var/root           #When I type this     Password:                   #I don't want to be prompted for my password                                 #I want to fill it from my `.bash_profile`      But:               cd /var/root                              #When I type this     -bash: cd: /var/root: Permission denied   #I still want this, or the like, returned      I saw this post on increasing sudo timeout, but I don't think it's quite equivalent. For example, I want it to carry across different shell log-in sessions. I could be wrong. Any suggestions regarding what to (or not to!) add to my `.bash_profile`, or which method (`timeout vs profile`) is preferable would be greatly appreciated! Thank you in advance.


title: How to install openssh in Crux Linux

text: In Crux Linux I already have installed SSH but when I use `ssh-keygen`, and try to use the command:               ssh localhost      to test SSH I get this error:               # ssh localhost     ssh: connect to host localhost port 22: Connection refused     #      So I decided to reinstall `openssh` but without `apt-get` I don't know how to do that.


title: Atheros ar8151 driver for kernel 3.x (fedora 16)

text: Yesterday, I installed Fedora 16 and found no wireless connection available. Then I found the ar81family driver But it seems like it does not work with kernel 3. I changed the makefile to ignore the kernel version, but it doesn't compile. It complains:               asm/linkage.h not found      How can I compile this module for my kernel?


title: Generate lists of page numbers for 2-up duplex printing: 2,3,… and 1,4,…

text: How can I generate the following increments?               2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47,...,135      and               4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,...,137      They are needed when printing pages. I can create incrementally counting "one liners" in bash, but I can't write one for this. Can anybody help me out?


title: Transfer large files without hogging the bandwidth (is there a BITS equivalent for Linux?)

text: Is an implementation of Microsoft's Background Intelligent Transfer Service (BITS) available for Linux systems? I'm looking at my options for transferring large files to a remote Linux server over the internet and I don't want it eat all of my (limited!) upstream bandwidth. I've successfully used BITS on Windows systems in the past but this time I'll need to be transferring to and from Linux servers. If it makes any difference both systems are likely to be running Ubuntu based systems although ideally I'd like a solution that is distro independent.


title: Installing php-cgi under Ubuntu for Cherokee web server

text: I have set up Cherokee web server on my server, and want to enable PHP and MySQL support for applications like Wordpress and phpBB. I have tried running these commands:               sudo apt-get install php5 mysql-server      And they both install, but when I try to link Chrokee with PHP in the admin interface it says it needs `php-cgi`? I also tried doing this:               sudo apt-get install php-cgi      But I got this error:               E: Couldn't find package php-cgi      I'm fairly new to setting up web servers and such so if someone could give me an example of how to set this up properly, I'd really appreciate it.


title: Installing Freebsd as guest OS on kvm without using VNC

text: I want to run Freebsd as a guest OS on kVM running on Ubuntu server 10.04. All howtos mention VNC as a necessity to start and finish the installation process. Can I install freebsd on kVM without using VNC? I would prefer to have a text-based installer that will work on the ssh shell prompt. My whole point here is that I don't want to install any graphical or GUI tools on my Host OS (ubuntu server).


title: Change who is able to chmod

text: Is there a way to change who can chmod (change the permissions of) a particular file? It is only the owner of the file (without sudo-ing it), if my experimentation has been correct? But what I want to do is allow on the **group** to be able to edit the file permissions, and not the owner. This isn't possible under the traditional Unix file system I don't think, but I'm wondering if there is a sneaky way it can be done using ACLs or something similar?


title: How to replace the third character in number to other character

text: IPS parameter include diff IP address as:               IPS="192.9.200.12-14 172.17.200.12-89 12.21.1.10-25 127.0.0.1-127"      I want to replace the third “.” In the IP address number to “,” How to achieve this by `sed` or `awk` ? Example:               echo $IPS | sed ……..      the requested output               192.9.200,12-14 172.17.200,12-89 12.21.1,10-25 127.0.0,1-127


title: SSHFS specify key

text: I've got a question that I've not been able to find an answer for. I have two computers, both of which run Ubuntu Linux 12.04. I have set up my first computer ("home") to be able to SSH into my second computer ("remote") using public/private RSA key authentication. This is not the first SSH connection that have set up using key authentication on my home computer, so my home computer has several id_rsa private keyfiles (each of which is for a different computer to SSH into). Thus, I am able to successfully SSH only when I specify a keyfile (in `ssh`, the `-i` option), using `ssh username@ipaddress -i path/to/keyfile/id_rsa.2`. That works great. However, I would also like to use `sshfs`, which mounts the remote filesystem. While `ssh` seems to play nice with multiple keys, I can't find a way to get `sshfs` to use the correct private key ("id_rsa.2"). Is there a way to get `sshfs` to do this? I would be very grateful for any advice you would be willing to offer. Thank you!


title: Can't compile glibc for 64 bit system

text: I'm trying to compile glibc-2.16 statically for x64 system,               ../configure --enable-kernel=2.6.9 --prefix=/run/shm/libc-static-64 --enable-static --enable-shared --host=i486-linux-gnu --build=i486-linux-gnu -q      Then I got:               configure: WARNING:     *** These auxiliary programs are missing or incompatible versions: sed     *** some features will be disabled.     *** Check the INSTALL file for required versions.     configure: error: the assembler must support TLS      In config.log I saw:               configure:354: checking for i386 TLS support     configure:376: gcc -c -g -O2 conftest.s 1>&5     conftest.s: Assembler messages:     conftest.s:8: Error: @TLSLDM reloc is not supported with 64-bit output format     conftest.s:8: Error: junk `@TLSLDM' after expression     conftest.s:9: Error: relocated field and relocation type differ in signedness     conftest.s:10: Error: relocated field and relocation type differ in signedness     conftest.s:11: Error: relocated field and relocation type differ in signedness     conftest.s:12: Error: @GOTNTPOFF reloc is not supported with 64-bit output format     conftest.s:12: Error: junk `@GOTNTPOFF' after expression     conftest.s:14: Error: @NTPOFF reloc is not supported with 64-bit output format     conftest.s:14: Error: junk `@NTPOFF' after expression     configure:379: $? = 1     configure:387: result: no     configure:390: error: the assembler must support TLS      Did I pass in wrong parameters?


title: Set the default permission

text: When I create a file, the permission is 644 (user rw, group r, other r). How can I make the default file generated to have permission as 664?


title: Is there any reason other than path setting why i get - "ns2 not installed" even after complete validated installation?

text: I have installed ns-2.35 on Linux Ubuntu 12.04 as per AJ's blog: http://ajlinx.wordpress.com/ Every step is correctly followed and I get the exact results as what is mentioned. I have edited the .bashrc file and set the paths as mentioned. I checked for validation and its all right. But still i get the ns package is not installed. Is there anything else that i need to check for?


title: Plain vi (not vim): Can't delete a line in insert mode: Is this behavior required by POSIX?

text: In the non-`vim` implementations of `vi` I've worked with, it's not possible to delete a line while in insert mode. `vim` does allows it--but it's my understanding that `vim` is not POSIX-compliant in its default configuration. Is a POSIX-compliant `vi` implementation not supposed to allow the deletion of lines in insert mode? Please quote the relevant parts of the standard where possible.


title: Shutting the computer down from Openbox

text: I've recently installed Openbox,and read a guide that said the PC should be shut down via this command:               gdm-control --shutdown && openbox --exit      However, it seems a bit counter intuitive. Why would I shut the computer down first and then exit Openbox? How is that even possible? Or is it maybe that `gdm-control --shutdown` just sends a message somewhere? What if the computer shuts down before Openbox can exit? Is this really "the right way"? **Info:** Link to Openbox guide: http://urukrama.wordpress.com/openbox-guide/   OS: Debian Linux 7.0