title: Use eth0 and eth1 for different subnets and assigned host name to interface?

text: I have a machine running SELES 10 with dual NIC Both the NICs are on separate subnets. The server uses a DHCP. So when one interface, `eth0`, gets the IP from DHCP and registers with DNS and then the other interface, `eth1`, gets an IP and registers with the DNS, it overwrites the DNS record. ### Questions   * Is there a way I can keep both records in the DNS and be able to use the interfaces separately?    * I've come across an article titled: 14.3. Configuring a DHCP Client, has anyone used the option `DHCP_hostname` where you can tie the interface to the hostname for the first `eth0` and `eth1` can be anything else?   * Has any one tested that?    * According to the article it would appear that it's possible, does that sound correct? **NOTE:** The article mentioned above is for Red Hat based distros if that matters.


title: Why doesn't source work when I call bash -c

text: I want to run a command that sources a script to take on some env. variables before executing, without sourcing them in my current shell. test.env               export test=1      None of these commands echo the env. variable: a) Shouldn't this work? Aren't I just executing these commands in a new shell and returning the output?               $ bash -c "source test.env && echo $test"      b) Here I execute test.env and try to run echo $test in the same process using exec.               $ bash -c "./test.env && exec echo $test"      c) Lastly I just tried this since it was a possible permutation. But it executes test.env and the echo command as separate processes.               $ bash -c "./test.env && echo $test"      And how can I get this to work where the env. variables are sourced before the 2nd command is executed?


title: Kali Linux Postgresql Error

text: I recently installed kali Linux and keep getting an error code starting metasploit this is the code               [...] Starting PostgreSQL 9.1 database server: main     [...] Error: could not exec /usr/lib/postgresql/9.1/bin/pg_ctl /usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/main -l /var/log/postgresql/postgresql-9.1-main.log -s -[FAILconfig_file="/etc/postgresql/9.1/main/postgresql.conf": ... failed!     failed!      Would really appreciate a solution been stuck for awhile.


title: can't connect using telnet, ssh. Connection refused

text: My imagine network (using marionnet) looks like that:               m1[eth0 192.168.1.1/26]      switch      m2[eth0 192.168.1.2/26] [eth1 192.168.2.1/28]     switch      m2[eth0 192.168.2.2/28]      I can ping from any machine to another. Now I want to:   1. run telnet on m1.   2. run ssh on m3.   3. connect from m3 to m1 using telnet.   4. start capturing packets and writing to the file from m2 using tcpdumy.   5. make a few commands on m1 through telnet session.   6. stop capturing packets   7. disconnect telnet session   8. stop telnet server on m1   9. start capturing packets on m2, but this time writing to other file.   10. connect from m1 to m3 using ssh   11. make a few commands.   12. stop capturing packets But I stayed at the beginning. What I've done: ### on m1:               $ xinetd start     $ nmap 192.168.1.1     ...     All ports are closed     ...      ### on m2:               $ dropbear start     $ telnet 192.168.1.1      Which results in this message: > unable to connect to remote host: Connection refused               $ nmap 192.168.2.2     ...     All ports are closed     ...


title: How to change font colors in terminal?

text: I know how to change the font color via preferences, but it changes the color of ALL text, as in below:    ![what I have](http://i.stack.imgur.com/J0N9L.png) What I'm going for is something more like this:    ![what I want](http://i.stack.imgur.com/Z6sCg.png) Any tips?


title: ctrl c vs. ctrl z with foreground job

text: `Ctrl`+`Z` stops the job whereas `Ctrl`+`C` kills the job. Why is that? Wouldn't the other way make more sense?               z@z-lap:~$ sleep 100&     [1] 4458     z@z-lap:~$ sleep 200&     [2] 4459     z@z-lap:~$ jobs     [1]-  Running                 sleep 100 &     [2]+  Running                 sleep 200 &     z@z-lap:~$ fg %1     sleep 100     ^Z     [1]+  Stopped                 sleep 100     z@z-lap:~$ jobs     [1]+  Stopped                 sleep 100     [2]-  Running                 sleep 200 &     z@z-lap:~$ fg %1     sleep 100     ^C     z@z-lap:~$ jobs     [2]+  Running                 sleep 200 &


title: Properly configuring symmetric active NTP?

text: I'm trying to configure two NTP servers to be peers to each other but I have no idea how to tell if it is working or not or whether my NTP configuration is even correct. I've put a simplified view of how my NTP servers are configured below.               Server A :        ntp.conf :          restrict default kod nomodify notrap noquery         peer Server B          Server B :       ntp.conf :          restrict default kod nomodify notrap noquery         peer Server A      I have two questions with regards to this setup: EDIT : Added clarification to question 1   1. Using the simplified `ntp.conf` I have put up, will the two NTP servers act as peers to each other by attempting to correct their time? I am looking for the simplest possible setup for ntp peers and I am not sure whether I am configuring it correctly.    2. How do I confirm that my NTP peer configuration is working? The reason I'm asking the above questions is because I have an alternative setup where the only change is that I've re-added the `nopeer` setting to the `restrict` stanza and in both cases the following output is returned:               Server A:       ntpdc -l         sym_active : Server B          Server B:       ntpdc -l         sym_active : Server A      Which makes no sense whatsoever since the `nopeer` directive should not enable me to peer the two servers together. Note : This is run on CentOS 6 EDIT : Actual ntp.conf files and ntpq -p as requested. I am not sure how useful these would be:               Server A:       driftfile /var/lib/ntp/drift            restrict default kod nomodify notrap noquery       restrict -6 default kod nomodify notrap noquery                 restrict 127.0.0.1        restrict -6 ::1             peer 192.168.122.3          Server B:       driftfile /var/lib/ntp/drift            restrict default kod nomodify notrap noquery       restrict -6 default kod nomodify notrap noquery            restrict 127.0.0.1       restrict -6 ::1            peer 192.168.122.2      The output of ntpq -p after more than 5 minutes (which exceeds the poll interval) is the following for each server.               Server A:          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      secure.jzhu.loc .INIT.          16 u   55   64    0    0.000    0.000   0.000          Server B:          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      masterdns.jzhu. .INIT.          16 u   33   64    0    0.000    0.000   0.000      Note : With or without the nopeer directive, the reach remains consistently at 0. Although that's more likely due to the fact that they are both stratum 16 servers than anything else. Note : iptables -F was run when performing this test and the default policy for the chain INPUT was ACCEPT.


title: Very high CPU load, but nothing significant in top

text: I'm running Ubuntu Linux 12.04.1, with VirtualMin 4.08.gpl GPL and 2 CPU cores. Pretty much all the time for the last few weeks, it's been running at well above load average of 5, usually up closer to 10, sometimes reaching 20. Right now, CPU load averages: 9.20 (1 min) 8.20 (5 mins) 7.81 (15 mins) At the same time, VirtualMin returns:               Virtual Memory: 996 MB total, 15.44 MB used     Real Memory: 3.80 GB total, 972.43 MB used      Local disk space: 915.94 GB total, 116.03 GB used      Have restarted (`shutdown -rf now`) the machine a few times and sure enough sooner or later we're back up with high CPU loads. Running `top` (or `htop`) returns nothing significant at all running at high CPU - in fact watching it for a few minutes and the highest item would maybe high 3% CPU. Top returns this also:               Cpu(s): 2.2%us, 1.2%sy, 0.0%ni, 0.0%id, 96.5%wa, 0.0%hi, 0.2%si, 0.0%st      The `%wa` concerns me as it's so high - seems to stay up above 80%. I understand this is % in wait, but not sure what that means in practical terms. Where can I start to debug this and figure out what's causing the high CPU load?


title: How do you make less show the filename?

text: I often have multiple terminal windows opened with less (eg comparing various log files). I forget which file is which. Is there a similar command to ^G in vi which displays the name of the file currently being viewed?


title: Bash: double equals vs -eq

text: I am doing integer comparison in bash (trying to see if the user is running as root), and I found two different ways of doing it: Double equals:               if [ $UID == 0 ]     then     fi      -eq               if [ $UID -eq 0 ]     then     fi      I understand that there's no >= or <= in bash, only -ge and -le, so why is there a `==` if there's a `-eq`? Is there a difference in the way it compares both sides?


title: We need a "C" list that contains all the elements of "A", but doesn't have any of "B"

text: We have two lists. A bigger "A":               A=`echo -e '1\n2\n3\n4\n5'`     echo "$A"     1     2     3     4     5      and a smaller "B":               B=`echo -e '1\n2\n3'`     echo "$B"     1     2     3      **Q:** But we need a third list that contains all the elements of "A", but doesn't have any of "B", how do I do it in bash?               echo "$C"     4     5      The numbers could be anything, from "foo" to 99, etc.. **UPDATE:** It's working in the shell by hand, but it's strange because if I put it in a script, it doesn't works!               cat a.txt      A=$(seq 5)     B=$(seq 3)     comm -23 <(sort <<< "$A") <(sort <<< "$B")     sh a.txt      a.txt: line 3: syntax error near unexpected token `('     a.txt: line 3: `comm -23 <(sort <<< "$A") <(sort <<< "$B")'      doing it by hand it works..:               A=$(seq 5)     B=$(seq 3)     comm -23 <(sort <<< "$A") <(sort <<< "$B")     4     5      **Why?** update on update: Need to use bash instead of "sh" :D


title: Which Hex code for /boot partition

text: I planned to install ArchLinux on my laptop. I'm only at the begining, trying to understand all the step before doing them. I'm only at the first step, i.e. partitioning, that I already have a small problem. I want to use my SSD as Raid0. My laptop uses UEFI boot so I have GPT table. To create the raid0, I have understood that I need to create one partition on each drive, then use `mdadm` to create the raid. However, before doing this, I need to create a partition for /boot. I have read that the size of this partition must be 300 MB. Is it true? My second question is about the hex code I've to use. I've seen that there is a code ef00 for EFI System, but also a code for MBR partition scheme and one for BIOS boot partition. I suppose that I have to use ef00. Is that correct?


title: Can a script be running even after it's been killed?

text: I know it sounds so stupid and I know it IS stupid but I ran a unix script to send me and my friend emails every few seconds to test mailx. Stupid thing is I used $ while true; do blah blah blah... and as far as I can tell, it has not stopped running because I kept getting emails long after I killed the process and deleted the file, or so it would seem at least. The flow of emails suddenly stopped at some point, but that's simply because we believe gmail started gave up on our accounts or something. We sent regular emails to ourselves and we haven't received any of it, and we haven't received anything for the past few hours. No, there's nothing new in the Spam box either. Would absolutely love some help right now!


title: SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

text: I am trying to automate the deploy of some .deb packages with an script. I want to execute `sudo dpkg -i $myDeb.deb` in a list of remote machines I can access with ssh. I've tried to automate the command with 'expect' inside a bash script, but I am obviously doing something wrong because I get a number of different errors (depending on where I put the quotation marks, basically) This is the function I have (will be called with something like: `_remoteInstallation "myPackage115.deb" "192.168.1.55"`. I know that in the remote machine, the .deb is going to be located in $HOME/Documents/:               function _remoteInstallation(){         local retval=1         local debToInstall=$(basename "$1")         local remoteMachine="$2"         spawned=$(expect -d -c "               set timeout 1800               spawn "/usr/bin/ssh -t borrajax@$remoteMachine /usr/bin/sudo /usr/bin/dpkg -i /home/borrajax/Documents/$debToInstall"'               expect {                     \"Are you sure you want to continue connecting\" { send \"yes\r\"; exp_continue }                     \"password\" { send \"myPassword\r\";  exp_continue }                     \"[sudo] password\" { send \"myPassword\r\";  exp_continue }                     default { exit 1 }               }         " )         retval=$?         return $retval     }      With the quotes in the spawned area like that, I get               expect: invalid option -- 't'      If I change it to:                spawn /usr/bin/ssh -t borrajax@$remoteMachine '/usr/bin/sudo /usr/bin/dpkg -i /home/borrajax/Documents/$debToInstall'      It looks like is trying to run the sudo dpkg command locally (first ssh(s) to '$remoteMachine' and then runs sudo dpkg locally, like two separate commands) With this:               spawn '/usr/bin/ssh -t borrajax@$remoteMachine \'/usr/bin/sudo /usr/bin/dpkg -i /home/borrajax/Documents/$debToInstall\''      I get that `couldn't execute "'/usr/bin/ssh": no such file or directory` (which is not true) ... and at this point, I ran out of ideas... **:-)** Any hint will be appreciated. Thank you.


title: Creating MySQL database and user without password

text: I am building a set of bash scripts which basically prepare apache virtual hosts, git repositories and other stuff on a cloud server. So far so good, everything is working, but a big problem occurred: **MySQL database and users creation**. The current scripts use ssh with keys to authenticate to the cloud server and everyone from my team can execute commands. I want to keep it this way and somehow let them create new MySQL database and user without needing to login to mysql as root or any other user with high privileges, but I don't have any solution for this. **Idea #1** is to create a new mysql user without password and give it full rights (like root) but make it usable only `@'localhost'`. **Idea #2** is to store the password for this MySQL control user in a file and make it accessible only to the current ssh user which the other scripts use. Then the mysql login will use this stored password to login and create the database and user. I don't know which option is better and I know they are dangerous. I ask for opinion and any better ideas.


title: Error in Script. Command find is skipping folders with space character

text: I need a script that counts the files in a directory (and sub). I've taken the followed script, and changed it to my need. It works like it should, except for folders with space characters. I'm pretty sure I'm missing quotes anywhere, but can't figure it out yet. ### Additional Informations   * Linux 2.6.22.19-0.4-default (this server is not in a productive environment anymore.)   * GNU find version 4.2.31   * I'm not able to rename the directories. ### Example Directory Structure               .     ..     01_infos     02_sent     03_inbox     04_public and private     197.     145.     329.     13.      ### Script               #!/bin/bash     # Write a script that will count the number of files in each of your subdirectories.     # -------------------------------------------------------------------------     # Copyright (c) 2001 nixCraft project <http://cyberciti.biz/fb/>     # This script is licensed under GNU GPL version 2.0 or above     # -------------------------------------------------------------------------     # This script is part of nixCraft shell script collection (NSSC)     # Visit http://bash.cyberciti.biz/ for more information.     # -------------------------------------------------------------------------          START=$HOME          # change your directory to command line if passed     # otherwise use home directory     [ $# -eq 1 ] && START=$1 || :          if [ ! -d $START ]     then             echo "$START not a directory!"             exit 1     fi          # use find command to get all subdirs name in DIRS variable     DIRS=$(find "$START" -type d)          # loop thought each dir to get the number of files in each of subdir     for d in $DIRS     do             echo "$d directory has $(find "$d" -maxdepth 1 -regex '.*\.' -type f | wc -l) files" || :     done      ### output               ./01_infos directory has 1 files     ./02_sent directory has 9 files     ./03_inbox has 4 files     find: ./04_public: No such file or directory


title: How can I shorten an if then else using the [] format

text: I want to shorten this to a one liner:               if ls --version 2>/dev/null | grep -q 'coreutils'; then alias ls='ls --color=always'     else alias ls='ls -G'     fi      I frequently use `[]` for conditionals, e.g. `[ -z(or -n) condition]` but haven't had to do an else part in this format yet. In ruby I would do `condition ? true : false` Is there an equivalent in bash? I tried               [ -z ls --version 2>/dev/null | grep -q 'coreutils'] ? alias ls='ls --color=always' : alias ls='ls -G'      but obviously that's not the right way to do it. I want a one-liner because I want all my `.bashrc` to fit in a smallish window (< ~50 lines) so, as with other multi-liners I condense them into one liners when possible. I am comfortable with sacrificing readability for size for this example. I also tried:               [ -z ls --version 2>/dev/null | grep -q 'coreutils'] && alias ls='ls --color=always' || alias ls='ls -G'      and               [ -n ls --version 2>/dev/null | grep -q 'coreutils'] && alias ls='ls --color=always' || alias ls='ls -G'      and               [ ls --version 2>/dev/null | grep -q 'coreutils'] && alias ls='ls --color=always' || alias ls='ls -G'      but I always get the 'else' alias not the 'then' alias I could just reverse it but I suspect that as it's not working right that wouldn't help. Only way to be sure though is to try it on OSX and I'm on ubuntu right now.


title: zsh copy and paste like emacs

text: I have noticed that zsh has a lot of things I see in emacs. I can make a selection with ctrl+space and selecting a region. I can make copies just like in emacs while I stay inside zsh. In emacs I'm able to use my system clipboard (previously with some additional configuration needed but this works out of the box now in emacs). In zsh I can't seem to paste from my clipboard using C-y and copying from zsh to my system cliipboard has the same issue. Is there a way around this?


title: What happens in UNIX/Linux when a program is bigger then size of memory?

text: I was wondering how embedded systems are able run programs bigger than the size of memory. If I had 1 GB of memory and the program was 1.5 GB, would the program load? Are there systems that only use available memory?


title: How can I make Flash fullscreen on an external display?

text: The question is: I have a laptop, and I extend my desktop on external display, so I get a wide desktop (3200px). When I make the videos on flash fullscreen, don't know why, but the fullscreen appears on my little part of desktop (the laptop display). Is there any way to tell flash to play fullscreen on my bigger part?


title: Disable a user's login without disabling the account

text: Let's say I create a user named "bogus" using the `adduser` command. How can I make sure this user will NOT be a viable login option, without disabling the account. In short, I want the account to be accessible via `su - bogus`, but I do not want it to be accessible via a regular login prompt. Searching around, it seems I need to disable that user's password, but doing `passwd -d bogus` didn't help. In fact, it made things worse, because I could now login to bogus without even typing a password. Is there a way to disable regular logins for a given a account? _Note: Just to be clear, I know how to remove a user from the menu options of graphical login screens such as gdm, but these methods simply hide the account without actually disabling login. I'm looking for a way to disable regular login completely, text-mode included._


title: How can I enable internet sharing without using the gui or apple script on snow leopard?

text: for some rather strange reason my sharing preferences tab crashes (it's a long story and there seems to be no good solution for it, it's looking for a ui object that no longer exists). Anyway, I want to enable internet sharing to share my macbook's internet connection with my iPad but I can't find a way to do it without the gui or apple script (which basically calls the gui).


title: No sound when attached to docking station

text: I have been using Linux and Ubuntu only since the last two months on my (2006) Sony Vaio VGN A617S laptop which is going pretty well on Ubuntu 10.10. When installing Ubuntu audio did get installed alright, and the speakers on the laptop itself are working well even now with the right drivers (snd-hda-intel) for the Realtek ALC260 soundcard. My problem is when laptop is docked to the A/V docking station (I have seen it referred as a port replicator as well - the model number is VGP-PRAV2), with its two external speakers. And these were not on when Ubuntu was being installed. What is interesting is the headphones jack on the laptop does work when the docking station does not. I have been trying hard and have already tried quite a few things I saw to be related issues, like: a) adjustments to some IEC958 in alsamixer b) using a custom mod for the ALC260 card All this is to no avail. If someone could help me with this, that would be really appreciated. Thank you.


title: Linux configuration settings

text: Where are the following configuration files located (e.g., Redhat)?   1. network settings (static/DHCP/DNS)   2. timezone   3. proxy for network   4. default language


title: Where can I see a list of kernel killed processes?

text: Is there some way I can check which of my processes the kernel has killed? Sometimes I log onto my server and find that something that should've run all night just stopped 8 hours in and I'm unsure if it's the applications doing or the kernels.


title: I am failing to 'git clone clutter'

text: While trying to build clutter from JHBuild, I get stuck at the stage where I have to clone it:               $ jhbuild buildone clutter     *** Checking out clutter *** [1/1]     git clone http://git.clutter-project.org/clutter     Cloning into clutter...      It just chills there, and it seems nothing is happening at all. When I check the bandwidth usage, there's hardly anything. **update 1** : Well, I wonder what happened, but it works now. Probably slow network on my (or their) side. **update 2** : One of JHBuild developers (on IRC): > git.clutter-project.org is unreliable; it will soon be moved to > git.gnome.org, afaik.


title: filter cron emails through procmail?

text: I'm using postfix/mutt/procmail on a Linux/Debian and I've some trouble filtering cron emails with procmail, I just want to move them to the cron/ maildir directory, but no lucky till now. I've several other rules on .procmailrc to move emails with ^From: to a specific directory, only the cron rule doesn't work. /etc/aliases:               postmaster:    root     root:          alex      .procmailrc:               :0:     * ^From: Cron Daemon <root@hellspawn>     * ^Subject: Cron .*     cron/      headers of a mail sent by cron:               Return-Path: <alex@hellspawn>     X-Original-To: alex     Delivered-To: alex@hellspawn     Received: by hellspawn (Postfix, from userid 1000)         id 27E2E1920C5B; Fri, 31 Jan 2014 16:30:09 +0100 (CET)     From: Cron Daemon <root@hellspawn>     To: alex@hellspawn     Subject: Cron <alex@hellspawn> $HOME/.getmail/getmail2.sh     Content-Type: text/plain; charset=UTF-8     X-Cron-Env: <SHELL=/bin/sh>     X-Cron-Env: <HOME=/home/alex>     X-Cron-Env: <PATH=/usr/bin:/bin>     X-Cron-Env: <LOGNAME=alex>     Message-Id: <20140131153009.27E2E1920C5B@hellspawn>     Date: Fri, 31 Jan 2014 16:30:09 +0100 (CET)      ~/.forward (guess it is useless in this case, just given a try):               |/usr/bin/procmail      What's wrong? **update 12/5/14** I ended up using the negated `!` rule below with _noop_ nested block `{ }` and _else_ `E`, seems like is the "Cron Daemon" part of the address creating the problem.               :0     * ! ^From.*root@hellspawn     * ! ^Subject:.*Cron Daemon     { }     :0 E     cron/


title: Switch to an application using its PID

text: I'm using Gnome. In vim, I want to map a key to switch to Firefox. I know that I should use bash commands (a command in form of `!...`). Is it possible to switch to an application using its PID?


title: Is there a way to make this one-liner faster?

text: ## Context I have a directory of thousands of zip files that are dated in the form `YYYYMMDD_hhmmss.zip` and each about 300K. Within each zip file is about 400 xml files each about 3K. ## The problem I need to be able to search and find a given string within a date-range of the zip files. ## The current (albeit mediocre) solution I have the following one-liner               find /home/mydir/ -type f | sort | \     awk "/xml_20140207_000016.zip/,/xml_20140207_235938.zip/" | \     xargs -n 1 -P 10 zipgrep "my search string"      The point of it is to   1. list all the files in my thousand-file directory   2. sort this list of files   3. retrieve a range of files based on given dates (this `awk` command only prints lines after that first matched string and up to that second matched string)   4. pass each line of the result which corresponds to a single file to `zipgrep` ## The question This one-liner runs horribly slow, even with 10 processes on a 24-core machine. I believe it's slow because of the `zipgrep` command but I'm not wise enough to know how to improve it. I don't know if I should be, but I'm a little embarrassed that a colleague wrote a java tool that runs faster than this script. I'd like to reverse that if possible. Then, does anyone know how to make this command faster in this context? Or to improve any part of it at all?


title: Kali Linux is not booting after installation after/before Windows 7

text: I have GPT, EFI (or UEFI?). I've installed Windows 7, then Kali Linux (in opposite order too), but Kali doesn't want to boot -- Windows wants. I tried to use `update-grub`, tried to switch the `bootable` flag of Windows loading partition off, but Kali boots only after deleting that partition. The problem is -- I can't boot Windows in this case. Also my `update-grub` doesn't see Windows 7 (I've installed `grub-efi-amd64` using LiveUSB and `chroot`), so I'll have to resolve this problem too.


title: DNS lookups sometimes take 5 seconds

text: I have a VM running Debian Wheezy on which some hostname lookups take several seconds to complete, even though the resolver replies immediately. Strangely, lookups with `getaddrinfo()` are affected, but `gethostbyname()` is not. I've switched to the Google resolvers to exclude the possibility that the local ones are broken, so my `/etc/resolv.conf` looks like:               search my-domain.com     nameserver 8.8.4.4     nameserver 8.8.8.8      My `nsswitch.conf` has the line:               hosts: files dns      and my `/etc/hosts` doesn't contain anything unusual. If I try `telnet webserver 80`, it hangs for several seconds before getting a name resolution. An `ltrace` output [1] shows that the hang is in a `getaddrinfo()` call:               getaddrinfo("ifconfig.me", "telnet", { AI_CANONNAME, 0, SOCK_STREAM, 0, 0, NULL, '\000', NULL }, 0x7fffb4ffc160) = 0 <5.020621>      However, `tcpdump` reveals that the nameserver replied immediately, and it was only on the second reply that `telnet` unblocked. The replies look identical:               05:52:58.609731 IP 192.168.1.75.43017 > 8.8.4.4.53: 54755+ A? ifconfig.me. (29)     05:52:58.609786 IP 192.168.1.75.43017 > 8.8.4.4.53: 26090+ AAAA? ifconfig.me. (29)     05:52:58.612188 IP 8.8.4.4.53 > 192.168.1.75.43017: 54755 4/0/0 A 219.94.235.40, A 133.242.129.236, A 49.212.149.105, A 49.212.202.172 (93)          [...five second pause...]          05:53:03.613811 IP 192.168.1.75.43017 > 8.8.4.4.53: 54755+ A? ifconfig.me. (29)     05:53:03.616424 IP 8.8.4.4.53 > 192.168.1.75.43017: 54755 4/0/0 A 219.94.235.40, A 133.242.129.236, A 49.212.149.105, A 49.212.202.172 (93)     05:53:03.616547 IP 192.168.1.75.43017 > 8.8.4.4.53: 26090+ AAAA? ifconfig.me. (29)     05:53:03.618907 IP 8.8.4.4.53 > 192.168.1.75.43017: 26090 0/1/0 (76)      I've checked host firewall logs and nothing on port 53 is being blocked. What is causing the first DNS reply to be ignored? [1] I've added a couple of lines to my `ltrace.conf` so I can see inside the `addrinfo` struct.


title: Which extension to use for text files? (Unix/Linux)

text: I noticed that I can read text files without an extension `.txt` just fine. How come? Should I save these files with or without the `.txt` extension? Also, what about `.ini` files? I usually use them like this: `config.ini`, should I remove the extension here to? Any general resources on how Linux handles file extensions would be useful.


title: Logrotate does not work for httpd service

text: We have logrotate working for several Centos servers. One new server has a slightly different setup, and for some reason logrotate does not work for the httpd service. When I start it manually, it does work as expected. I've set this up last week, and it didn't run once in four days. The file /etc/cron.daily/logrotate exists, so I guess the cron job should run daily. Contents of /etc/logrotate.conf               # see "man logrotate" for details     # rotate log files weekly     weekly          # keep 4 weeks worth of backlogs     rotate 4          # create new (empty) log files after rotating old ones     create          # use date as a suffix of the rotated file     dateext          # uncomment this if you want your log files compressed     #compress          # RPM packages drop log rotation information into this directory     include /etc/logrotate.d          # no packages own wtmp and btmp -- we'll rotate them here     /var/log/wtmp {         monthly         create 0664 root utmp             minsize 1M         rotate 1     }          /var/log/btmp {         missingok         monthly         create 0600 root utmp         rotate 1     }          # system-specific logs may be also be configured here.      Contents of /etc/logrotate.d/httpd. I suppose these override the logrotate.conf settings.               /var/log/httpd/*log {         daily         compress         rotate 20         missingok         notifempty         sharedscripts         delaycompress         postrotate             /sbin/service httpd reload > /dev/null 2>/dev/null || true         endscript     }      Why doesn't it work?


title: How to create a bootable USB with Windows?

text: How would I go about creating a CentOS 7 bootable USB drive with Windows? I've read the howto page for it and it says that Unetbootin and Universal USB installer won't work for CentOS 7. In addition, I've already tried dd for Windows, and that didn't work properly either - booting from the USB drive resulted in a "Machine Check Error".


title: Just installed Debian - Having trouble connecting to wireless network

text: I know this question has been asked before but none of the solutions are working for me. I just installed Debian and I'm relatively new to Linux. I'm running Debian 7.4 (Wheezy) with Gnome desktop. At the moment, I'm connected to the Internet via Ethernet cable and I'm having trouble connecting to a wireless network. My network uses WPA2. I've tried connecting with wpa_supplicant but so far that hasn't worked. I don't know where I'm messing up. It would be great if someone with experience in this could help me out. Thanks. Note: Just let me know what information you need (for example, the output of a certain command) and I will supply you with that. Edit: I followed http://askubuntu.com/questions/138472/how-do-i-connect-to-a- wpa-wifi-network-using-the-command-line and when I execute               wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext && dhclient wlan0         I get the following error:               Could not read interface wlan0 flags: No such device     WEXT: Could not set interface 'wlan0' UP     wlan0: Failed to initialize driver interface


title: Which Desktop Linux version can run decently on For P4 & 750MB Ram

text: I just installed Ubunta 13.10 on an old P4 with 750MB Ram, but the system is running too slow to be used for anything. I had XP running on it and worked fast enough to use, but I decided I wanted to try Linux because I read it would run faster on it. 1)Ubunta did not appear to reformat the harddrive, I don't know if that should have been done or not, but it appeared to install right over XP. Is there some method of installation, other than booting the ISO and following the steps to install that would make it run faster? 2)Is there a better desktop version of Linux would run faster on a P4 with 750MB of RAM.


title: How are signals implemented in Linux?

text: When one process sends a signal to another process, does receiving process wait until it is rescheduled to run? So if every 1 ms we choose one process to run, does that mean the latency from generating the signal to delivery of the signal is around 0.5 ms? (Suppose we only have two processes.)   And more generally, how are signals implemented in Linux?


title: Execute commands on TMUX Detach

text: Is it possible to execute commands on tmux detach? I usually have a rails console and server running in the tmux session, on detach is it possible to automatically end those? Thanks.


title: Routing for multiple uplinks/providers

text: I have a PC with two internet connections. The first one is an Ethernet interface to connect to my local network and access internet via my router. The second one use a GSM modem to connect with ppp. I would like to be able to use each connection independently when specifying the interface, e.g.:               ping -I eth0 www.google.com     ping -I ppp0 www.google.com      And to be able to use eth0 by default if no interface is selected and the connection via eth0 works but ppp0 if the connection via eth0 does not work. I read the this article and created the following rules:               # Main table     ip route add 10.0.0.0/24 dev eth0 src 10.0.0.100     ip route add 10.64.64.64 dev ppp0 src 10.123.122.101     ip route add default via 10.0.0.1          # Specific tables     ip route add 10.0.0.0/24 dev eth0 src 10.0.0.100 table eth0     ip route add default via 10.0.0.1 table eth0     ip route add 10.64.64.64 dev ppp0 src 10.123.122.101 table ppp0     ip route add default via 10.64.64.64 table ppp0          # Rules     ip rule add from 10.0.0.100 table eth0     ip rule add from 10.123.122.101 table ppp0      At first it seems to work. However the eth0 table seems to be never used. I expected the following to happen:               ping -I eth0 www.google.ch    # Use default gateway in table eth0     ping -I ppp0 www.google.ch    # Use default gateway in table ppp0     ping www.google.ch            # Use default gateway (main)      However if I remove the default gateway (main) the eth0 interface does not work at all. There is obviously something I don't understand. Can you explain me how to achieve what I want? EDIT according to @derobert answer: I tested the following configuration but still get the same error (ok for ppp0 but not working for eth0). Routes:               # ip rule list     0:      from all lookup local     1500:   from 10.0.0.100 lookup eth0     1501:   from 10.123.122.101 lookup ppp0     2000:   from all fwmark 0x1 lookup eth0     2001:   from all fwmark 0x2 lookup ppp0     32766:  from all lookup main     32767:  from all lookup default          # ip route list table eth0     10.0.0.0/24 dev eth0  src 10.0.0.100     default via 10.0.0.1 dev eth0          # ip route list table ppp0     10.64.64.64 dev ppp0  src 10.123.122.101     default via 10.64.64.64 dev ppp0          # ip route list table main     10.64.64.64 dev ppp0  src 10.123.122.101     192.168.1.0/24 dev eth1  src 192.168.1.1     10.0.0.0/24 dev eth0  src 10.0.0.100      Firewall:               # iptables -L     Chain INPUT (policy DROP)     target     prot opt source               destination     ACCEPT     all  --  anywhere             anywhere          Chain FORWARD (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination          # iptables -L -t mangle     Chain PREROUTING (policy ACCEPT)     target     prot opt source               destination     CONNMARK   all  --  anywhere             anywhere            CONNMARK restore     RETURN     all  --  anywhere             anywhere            mark match !0x0     MARK       all  --  anywhere             anywhere            MARK set 0x1     MARK       all  --  anywhere             anywhere            MARK set 0x2          Chain INPUT (policy ACCEPT)     target     prot opt source               destination          Chain FORWARD (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination          Chain POSTROUTING (policy ACCEPT)     target     prot opt source               destination     MARK       all  --  anywhere             anywhere            MARK set 0x1     MARK       all  --  anywhere             anywhere            MARK set 0x2     CONNMARK   all  --  anywhere             anywhere            CONNMARK save          # iptables -L -t nat     Chain PREROUTING (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination          Chain POSTROUTING (policy ACCEPT)     target     prot opt source               destination     SNAT       all  --  10.0.0.1             anywhere            to:10.0.0.100     SNAT       all  --  10.64.64.64          anywhere            to:10.123.122.101      I removed all the other firewall rules to be sure they do not interfere. I get this results:               # ip route get 8.2.1.1 from 10.0.0.100     8.2.1.1 from 10.0.0.100 via 10.0.0.1 dev eth0          # ip route get 8.2.1.1 from 10.123.122.101     8.2.1.1 from 10.123.122.101 via 10.64.64.64 dev ppp0          # ping -I ppp0 8.8.8.8     PING 8.8.8.8 (8.8.8.8): 56 data bytes     64 bytes from 8.8.8.8: seq=0 ttl=45 time=350.108 ms     64 bytes from 8.8.8.8: seq=1 ttl=45 time=349.768 ms     64 bytes from 8.8.8.8: seq=2 ttl=45 time=329.671 ms     ^C     --- 8.8.8.8 ping statistics ---     3 packets transmitted, 3 packets received, 0% packet loss     round-trip min/avg/max = 329.671/343.182/350.108 ms          128# ping -I eth0 8.8.8.8     PING 8.8.8.8 (8.8.8.8): 56 data bytes     ^C     --- 8.8.8.8 ping statistics ---     5 packets transmitted, 0 packets received, 100% packet loss      The rules seems to be OK but obviously there is another problem. I don't really understand the role of the SNAT here. I added the rules to reflect the configuration of the answer be they might be wrong.


Can a Linux command have capital letter(s)? I know it's supported but i want to be sure if it's a "problem" or considered "not a good thing"?


title: Use eth interface to connect to a router and wlan for the internet

text: I am currently trying to configure a router to which I connect to (to its web interface) using an Ethernet cable through the `eth0` interface. That router doesn't have access to the internet. Now, I have access to another network (different IP range and all) that does have access to the internet through my wireless interface `wlan0`. I would like to use `eth0` to only connect to the router I am trying to configure and `wlan0` for the rest of the connections. That way, I could do some research while trying to configure the router. I'm sure it's doable, with some kind of routing but I haven't been able to find anything that works. The issue is that when I plug the Ethernet cable, the system starts using that `eth` connection for everything. To sum up a bit: Assuming the router's address is 10.0.0.1, can I do something to route traffic going to 10.0.0.1 through the `eth0` interface and anything else through `wlan0`? I am using Debian Squeeze.


title: Is it possible to access a remote computer on a different network using Remmina and Vino and how?

text: I am using Linux Mint 14. Remmina and Vino is installed on my system. Now I want to access another remote computer (which is in different network and IP is not static). I only want to use VNC. Is it possible with Remmina and Vino? If so, how can I do that?


title: How to start only one application on booting in RHEL 6?

text: I want to start only one application without any desktop after booting the system, it is like only application should be there not anything in RHEL 6.


title: Compile Unix with a custom application

text: I wonder, is it possible to compile Unix along with a my custom program so that it runs only my custom program on start up of computer, as if my program starting with boot up?


title: Linux Web Kiosk

text: Hi I'm having a idea of develop a light weight Linux kernel which will boot and open a web browser in full screen and request data from pre define URL. Can any one give me some guides on this please.


title: Create a browser only session (Ubuntu)

text: I was recently in a Virgin media shop and was interested to see that they had laptops running Ubuntu for customers to browse the web on. The setup itself was interesting and I'm wondering if anyone knows how to recreate it. The features were: Only running Firefox, no other panels or menus I tried running a terminal (`ctrl+alt+t`) but it gave a message saying the user didn't have permission to access the x server (or something similar) I realise to recreate this is a function of controlling both user privileges and session parameters but I'm not sure how I would go about it. Any ideas?


title: Debian based system, only one gui program, nothing else

text: I would like to make a debian system where you can only open one GUI program at boot, no other graphical interface, no minimize, or any X apart from that program, is there a way to do it on debian if possible, or any other custom distro? I just want to boot open the program and allow the user to only see and use that program.


title: How to setup Kiosk type functionality in Linux mint cinnamon?

text: I'm using Linux Mint Cinnamon. I want to setup the computer to act as a kiosk, where the user can only really interact with Firefox in full screen mode. What is the easiest way to lock the machine down? Does `dconf` or `gconf` work with Cinnamon? Should I just ditch Cinnamon for xfce, or some other WM with built in kiosk mode?


title: Can i run a program on Linux startup instead of a Desktop Manager like Gnome, KDE, etc.?

text: I have a rasberry pi running raspbian and i would like it to "boot" into my program instead of starting Lxde. So basically let's say i will write a OpenGL program that will go fullscreen and i would display stuff on it. How could i configure raspbian (which is basically debian - but info for any linux would do as i will be able to figure it out how to adjust this to raspbian) so that on boot it will just start my program that will display stuff on the monitor?


title: Discard stdout of a command for t seconds

text: I am working on some batch scripts involving the following:   * Run some non-terminating sub-processes (asynchronously)   * Wait for **_t_** seconds   * Perform other task **X** for some time   * Terminate subprocesses Ideally, I would like to be able to differentiate the stdout of the sub- processes which has been emitted _before_ **X** from that which has been emitted _after_ **X**. A few ideas come to mind, although I have no idea as to how I would implement them:   * Discard stdout for **t** seconds   * Insert some text (for instance, 'Task X started') to visually separate the sections   * Split stdout into various output streams


title: CentOS 6.3 (kernel 2.6.32-279) & wl-kmod won't compile

text: I have been trying (unsuccessfully) to compile a Broadcom driver for use on my CentOS laptop. Previously, I had used the instructions located here to compile and it worked flawlessly. Now, I cannot get the driver to compile. Admittedly the errors look like something I should be able to simply fix, however, I have not found a way to get it to work for me yet. Here is what I get when I run the rpmbuild on my laptop:               $rpmbuild --rebuild --target=`uname -m` wl-kmod-5_100_82_112-3.el6.elrepo.nosrc.rpm      Installing wl-kmod-5_100_82_112-3.el6.elrepo.nosrc.rpm     warning: InstallSourcePackage at: psm.c:244: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY     warning: user ajb does not exist - using root     warning: group ajb does not exist - using root     warning: user ajb does not exist - using root     warning: group ajb does not exist - using root     warning: user ajb does not exist - using root     warning: group ajb does not exist - using root     Building target platforms: i686     Building for target i686     Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.BX2aRY     + umask 022     + cd /home/jblair/rpmbuild/BUILD     + LANG=C     + export LANG     + unset DISPLAY     + cd /home/jblair/rpmbuild/BUILD     + rm -rf wl-kmod-5_100_82_112     + /bin/mkdir -p wl-kmod-5_100_82_112     + cd wl-kmod-5_100_82_112     + /bin/chmod -Rf a+rX,u+w,g-w,o-w .     + cd /home/jblair/rpmbuild/BUILD     + cd wl-kmod-5_100_82_112     + /usr/bin/gzip -dc /home/jblair/rpmbuild/SOURCES/hybrid-portsrc_x86_32-v5_100_82_112.tar.gz     + /bin/tar -xf -     + STATUS=0     + '[' 0 -ne 0 ']'     + /bin/chmod -Rf a+rX,u+w,g-w,o-w .     + /bin/sed -i 's/\/lib\/modules\/`uname -r`\/build/\"\${KSRC}\"/' Makefile     + echo 'override wl * weak-updates/wl'     + /bin/cat     + /bin/cat     + exit 0     Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.T8r6eV     + umask 022     + cd /home/jblair/rpmbuild/BUILD     + cd wl-kmod-5_100_82_112     + LANG=C     + export LANG     + unset DISPLAY     ++ uname -r     + /usr/bin/make KSRC=/usr/src/kernels/2.6.32-279.1.1.el6.i686     KBUILD_NOPEDANTIC=1 make -C "/usr/src/kernels/2.6.32-279.1.1.el6.i686" M=`pwd`     make[1]: Entering directory `/usr/src/kernels/2.6.32-279.1.1.el6.i686'     CFG80211 API is prefered for this kernel version     Using CFG80211 API       LD      /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/built-in.o       CC [M]  /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/shared/linux_osl.o       CC [M]  /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_linux.o       CC [M]  /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_iw.o       CC [M]  /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.o     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:64: warning: 'enum tx_power_setting' declared inside parameter list     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:64: warning: its scope is only this definition or declaration, which is probably not what you want     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1110: warning: 'enum tx_power_setting' declared inside parameter list     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1110: error: parameter 2 ('type') has incomplete type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c: In function 'wl_cfg80211_set_tx_power':     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1123: error: 'TX_POWER_AUTOMATIC' undeclared (first use in this function)     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1123: error: (Each undeclared identifier is reported only once     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1123: error: for each function it appears in.)     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1125: error: 'TX_POWER_LIMITED' undeclared (first use in this function)     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1131: error: 'TX_POWER_FIXED' undeclared (first use in this function)     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c: At top level:     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1649: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1651: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1652: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1653: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1654: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1658: warning: initialization from incompatible pointer type     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c: In function 'wl_inform_single_bss':     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:1817: error: too few arguments to function 'ieee80211_channel_to_frequency'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c: In function 'wl_bss_roaming_done':     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 2 of 'cfg80211_roamed' from incompatible pointer type     include/net/cfg80211.h:3035: note: expected 'struct ieee80211_channel *' but argument is of type 'u8 *'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 4 of 'cfg80211_roamed' makes pointer from integer without a cast     include/net/cfg80211.h:3035: note: expected 'const u8 *' but argument is of type 's32'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 5 of 'cfg80211_roamed' makes integer from pointer without a cast     include/net/cfg80211.h:3035: note: expected 'size_t' but argument is of type 'u8 *'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2117: warning: passing argument 6 of 'cfg80211_roamed' makes pointer from integer without a cast     include/net/cfg80211.h:3035: note: expected 'const u8 *' but argument is of type 's32'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2117: error: too few arguments to function 'cfg80211_roamed'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c: In function 'wl_bss_connect_done':     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 2 of 'cfg80211_roamed' from incompatible pointer type     include/net/cfg80211.h:3035: note: expected 'struct ieee80211_channel *' but argument is of type 'u8 *'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 4 of 'cfg80211_roamed' makes pointer from integer without a cast     include/net/cfg80211.h:3035: note: expected 'const u8 *' but argument is of type 's32'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 5 of 'cfg80211_roamed' makes integer from pointer without a cast     include/net/cfg80211.h:3035: note: expected 'size_t' but argument is of type 'u8 *'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2149: warning: passing argument 6 of 'cfg80211_roamed' makes pointer from integer without a cast     include/net/cfg80211.h:3035: note: expected 'const u8 *' but argument is of type 's32'     /home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.c:2149: error: too few arguments to function 'cfg80211_roamed'     make[2]: *** [/home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112/src/wl/sys/wl_cfg80211.o] Error 1     make[1]: *** [_module_/home/jblair/rpmbuild/BUILD/wl-kmod-5_100_82_112] Error 2     make[1]: Leaving directory `/usr/src/kernels/2.6.32-279.1.1.el6.i686'     make: *** [all] Error 2     error: Bad exit status from /var/tmp/rpm-tmp.T8r6eV (%build)               RPM build errors:         InstallSourcePackage at: psm.c:244: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY         user ajb does not exist - using root         group ajb does not exist - using root         user ajb does not exist - using root         group ajb does not exist - using root         user ajb does not exist - using root         group ajb does not exist - using root         Bad exit status from /var/tmp/rpm-tmp.T8r6eV (%build)      Any help you can provide would be most appreciated. I will not have access to the box in question until this evening, but I should be able to answer most questions and will try any suggestions I receive as soon as I return from work tonight.


title: How do I install Ubuntu/Mint on top of Debian?

text: I have a basic dual setup with Linux Debian and Windows 7 (Grub is my bootloader). However, since this machine will be donated to a friend that does not know a lot about computers, I would like to install a more user friendly Linux distro. I suspect that if I try to install on top of Debian, the bootloader will be overwritten and hell will break loose. Any ideas on how to **properly and safely** install the new distribution? Maybe resize a partition, format it, install the new distro and then delete the Debian partition?


title: Book on Linux OS design?

text: What is a good book about why linux has been designed the way it has? Such as why are HDs in `/dev/sda`, why `/dev/` null, zero, urandom and such are files (or pipes). Why do we have loopback device (I see 0-7 and control on my linux distro), why we have bin, sbin, lib and usr (and the difference between them). Everything about `/proc`. What is inside of the kernel and what isn't? From my memory init.d isn't part of the kernel and I was unsure how an program would be executed and know when to run these. What are block and character device represented as files? and why couldn't a character device be a '1 byte' (or int) block device? I have no idea why everything is a file (including sockets) and what happens when I write `cat /proc/cpuinfo`. Is that a named pipe to the OS which reads the CPU info on the fly and generate that text each time I call it?


title: Finding information on obscure libraries

text: Is there a website that organizes and explains all the various libraries that are available to use when developing on Linux? I have, from time to time, come across some very interesting and extremely specialized libraries. I also constantly find myself wondering what a particular `lib` file is when I am browsing my package manager or even digging through `/usr/lib`.


title: Why does SSH have unsecure defaults?

text: Why does SSH come with such an unsecure default configuration? to name what I consider unsecure defaults:   * root login enabled on SSH    * SSH protocol version 1 (which is vulnerable to MIM attacks) allowed  There also is no built in mechanism to handle brute forceattacks I can understand that interoperability and compatibility are important for a new system, but putting a server on the web with these defaults is a major security concern. If someone didn't know about these configuration options, they could put a server live that is very vulnerable to being bruteforced and be ignorant of the problem long enough for someone to gain access. The idea of bruteforcing root on SSH has been around a long time, and there is an ever-present 'background noise' of root login attempts on any server from bots and the like. It would make sense to ship SSH with some defaults that would help mitigate this threat. What is the reason for these unsecure defaults?


title: No package * available. cannot install git through yum

text: I am trying to install git on my Red Hat Enterprise Linux 6.5 server and have hit a brick wall. I can't find the package dependencies for git using yum.                   [root@FOOBAR mydir]# yum install curl-devel expat-devel gettext-devel \         >   openssl-devel zlib-devel         Loaded plugins: product-id, refresh-packagekit, security, subscription-manager         This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.         Setting up Install Process         No package curl-devel available.         No package expat-devel available.         No package gettext-devel available.         No package openssl-devel available.         No package zlib-devel available.         Error: Nothing to do      After reading a few forum posts, I found the EPEL package here, and installed it:                   [root@FOOBAR mydir]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm         Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm         warning: /var/tmp/rpm-tmp.IlnMHM: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY         Preparing...                ########################################### [100%]            1:epel-release           ########################################### [100%]      however even after this i still get the same error. can someone please help me out? **UPDATE:** The output of `yum repolist`:               [root@FOOBAR ~]# yum repolist     Loaded plugins: product-id, refresh-packagekit, security, subscription-manager     This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.     repo id          repo name                                                status     epel             Extra Packages for Enterprise Linux 6 - x86_64           10,657     repolist: 10,657      **UPDATE2:** I changed the `/i386/` to `/x86_64/` because i erased the i386 one and replaced it with epel 64 bit repo.


title: Iterate over n files?

text: I've got something fairly simple I want to do. I want to use `montage` on a directory that contains thousands of images, with very few options, namely:               me@home$ montage -size 256x256 DSC01*.JPG.svg output.png      ...but that's just not good enough, as it only grabs about 100 images at a time; neither is               me@home$ montage -size 256x256 *.svg output.png      ...which grabs all of the images at the same time, as the resulting file is too big to parse. What I _want to do_ is to iterate over something like 100-200 files at a time. I guess this could be implemented using a for loop (?), but I'm just a bit confused about how to do that. I guess there's probably a clever way to use `find -exec` or `xargs` that I'm not thinking of. I'm using `bash`, but I use `zsh` occasionally. _So, in conclusion, I'm looking for a one liner that, given 2600 image files, calls montage about 13 or 26 times (once for each 100-200 files), and given n files, can be called a multiple of n times._


title: Can't get past EFI to install RHEL on HP Itanium Server

text: When I am trying to install RHEL (6.3, 5.8, 4.8) on an HP Integrity Server rx2660 Itanium with 4GB RAM, I keep getting to the same point which is               Loading file efi\boot\initrd.img...done      After that nothing happens and I can’t continue installing RHEL. Also, when I hit `Ctrl`+`Alt`+`F3`, I see the message               Unable to identify CD-ROM format     unable to load NLS charset utf8      and the SCSI CDROM fails to mount a CD/DVD.


title: Skype doesn't work with webcam A4Tech PK-130MG

text: I've just installed Mint 12 on a desktop previously running Windows Vista. Despite using Ubuntu and Kubuntu on other machines, i still see myself as a beginner on GNU/Linux. On this Mint 12 machine, I can't make Skype, nor GTalk, nor any msn protocol client recognize the webcam, which is a A4Tech PK-130MG. I tried to install Ekiga, but the screen freezes at the first instant when the webcam is started. Only Camorama was able to properly capture the image from webcam. Nor Cheese, nor kamoso work. When anyone of them is started, the webcam image is showed for only an instant, after which the program crashes. I've already tried, without sucess, the procedure described at http://community.linuxmint.com/tutorial/view/219 As nothing worked till now, i'm here asking for help. Thanks.


title: dmesg message repeat

text: I keep getting this message repeated in `dmesg`:               [215259.269481] [UFW BLOCK] IN=eth0 OUT=     MAC=01:00:5e:00:00:01:00:26:f2:46:24:8e:08:00      SRC=192.168.1.1 DST=224.0.0.1 LEN=36  TOS=0x00 PREC=0x00      TTL=1 ID=1711 DF PROTO=2          [215270.008461] CPU2: Core temperature above threshold,      cpu clock throttled (total events = 2376639)      Any idea why?


title: "Could not get updates: Failed to process request."

text: I get this error on Debian Wheezy when I try to install automatic updates:               Could not get updates     Failed to process request.     More details      E: Error http://security.debian.org/ wheezy/updates/main iceweasel-l10n-en-gb all 1:24.7.0esr-1~deb7u1           404  Not Found [IP: 212.211.132.32 80]      I have now done what the top response here says: "Software update" appears empty in Debian, but there are upgrades available and then did `apt-get update && apt-get -u dist-upgrade`. It started doing updates, then I got the error message: > >     Could not get updates >     Failed to process request >     More details >     Operation was cancelled Yet it still appears to be doing the updates I don't really know what I'm doing very will with Linux so I feel hesitant to just be bashing in a load of commands of which I don't really know the effects; I am in the process of studying the tutorial right now, but this update seems critical for security. I think it has actually worked now using the terminal way I described above, and I'm reading http://forums.debian.net/viewtopic.php?f=30&t=113186 to help me figure out the problem with the Software Update program. Edit: Now I can't hibernate, it tries to hibernate and then comes back with the 'Could not get updates Failed to process request.' error..


title: How to create a kernel source tree?

text: I am reading a book on creating drivers on Linux, I do not have too much experience with Linux, I have installed a quite a few distros before but I have always used windows as my main operating system. I know some `C`, but I am mainly a `C#` programmer. I wish to learn (for fun) driver programming, and hope it will teach me some things about Linux and help me "get into it". My first hurdle is to find a distro with a standard `2.6.x` kernel. I tried to find one but they are all past `3.x` now. Any one know of a suitable one for this kind of task? Also the book says I should get a standard kernel from `kernel.org` and build a source tree. I have no idea what that means, please if someone could generally explain the steps. This is the book: http://oreilly.com/openbook/linuxdrive3/book/


title: btrfs on SD card, what does "Btrfs detected SSD devices, enabling SSD mode" mean exactly?

text: I'm experimenting with using btrfs on my Debian Linux armhf system. The rfs is on a micro SD card. On bootup I get the message "Btrfs detected SSD devices, enabling SSD mode". What features does this SSD mode give me exactly?


title: Problem downloading Java JDK with WGET on Ubuntu

text: I'm attempting to install the Java JDK through the command line using `WGET` on ubuntu (no desktop). Here is the picture I took. The file that was downloaded was not the tar ball of the JDK: How can I download it via WGET? ![enter image description here](http://i.stack.imgur.com/yfCjR.jpg)


title: btrfs snapshots without subvolumes?

text: I'm starting to use btrfs. I want to be able to snapshot certain directories but do not want to create sub-volumes. Is this possible?


title: Any way in Bash to write to a file every X seconds without closing it?

text: The hardware watchdog on my system needs a `0` written to `/dev/watchdog` at less than 60 seconds interval or it will fire. The file handle must be kept open however or the watchdog is then disabled. E.g.               echo "0" > /dev/watchdog      does not work, as the file handle is closed after the echo is completed. Is there any way to setup a loop in bash that will write `0` periodically to `/dev/watchdog` but keep the file handle open?


title: How can I modify Slingscold source code to stop it exiting each time it launches an application?

text: I am on Ubuntu 14.04 platform. I downloaded Slingscold application launcher, here the sources http://sourceforge.net/projects/slingscold/files/?, `bzr branch lp:slingshot` and `ppa:noobslab/apps` I compiled and installed it. It's a very nice application, except a bothering side; It takes 15-20 seconds to load in my system and it exits itself after launching application, I have to restart and wait for it to load each time. I think it runs as intended but it is slow in that way. It's written in _vala_. Would anybody take a look at the source code and modify it to not exit the process, hide the dashboard upon launching application and when I click on slingscold icon bring dashboard foreground? EDIT: For more info about Slingscold check out this link http://www.noobslab.com/2014/06/slingscold-launcher-is-now-available.html


title: Interfacing with a custom camera in Linux on the beaglebone

text: I'm new to Linux development and need some pointers to help me get a camera (OV7670) working on a beaglebone running Debian. Using the camera capes as a guide, I've connected the camera to the GPMC pins on the beagleboard and the I2C pins. However I'm a bit stumped to what I need to do in software to get Linux to recognize it as a camera and be able to use it to read a frame from the GPMC. From the readings I've done, it seems like I need to load a kernel module. I found that there is a OV7670 C driver file in the kernel source. What kind of modifications (if any) would I need to do? I'm also open to any suggested readings and tutorials that would help me.


I tried a command `cp /vol/examples/tutorial/science.txt .` and I get the error -               cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory      I don't understand why this is happening. I went to cygwin home folder and created the necessary folder structure and text file. I also checked the folder structure and names. Also, I go into `~/vol/examples/tutorial` and then do `cat science.txt` and I can read the document. Then why does the CP command not work ?


title: Make the DNS server update my host name

text: I have some sort of DNS server running on my router (running Asuswrt-Merlin, and I can run commands from another Linux computer by host name, i.e., `ping web-server`. However, when I change settings on my router, it reboots, and then referring to servers by name fails (although connecting by IP works fine). If I reboot the server (not the router), suddenly it works again, so presumably the server is sending some sort of command. What command is this? I'd like to run it manually with cron or something. If it matters, the server is running Ubuntu 13.10.


title: Where is the trash folder in FreeBSD / PCBSD?

text: I'd like to delete - undelete files using the shell in PCBSD. But... I don't know where the "trash" folder is. Can anyone tell me?


title: FreeBSD: Can't install Python 2.7

text: I can't seem to be able to install Python 2.7 on my FreeBSD system. Here is some info:               # portsnap update     Ports tree is already up to date.      Version:               # uname -r     7.1-RELEASE      Installation:               # cd /usr/ports/lang/python27/     # make     ===>  Found saved configuration for python27-2.7.5_1     => Python-2.7.5.tar.xz doesn't seem to exist in /usr/ports/distfiles/python.     => Attempting to fetch ftp://ftp.lv.freebsd.org/pub/FreeBSD/distfiles/python/Python-2.7.5.tar.xz     Python-2.7.5.tar.xz                           100% of    9 MB  159 kBps 00m00s     ===> Fetching all distfiles required by python27-2.7.5_1 for building     ===>  Extracting for python27-2.7.5_1     => SHA256 Checksum OK for python/Python-2.7.5.tar.xz.     ===>   python27-2.7.5_1 depends on file: /usr/local/bin/xz - found     tar: Unrecognized archive format: Inappropriate file type or format     tar: Error exit delayed from previous errors.     *** Error code 1          Stop in /usr/ports/lang/python27.     *** Error code 1          Stop in /usr/ports/lang/python27.      Any help is highly appreciated.


title: Horrible Iceweasel and Opera performance when watching youtube

text: I have 64-bit Debian on laptop with Intel Core 2 Duo T9300 2.5GHz, Nvidia Quadro NVS140M GPU and 4GB RAM. For now - im on vacation and im using 3G USB modem. I have relatively slow but high quality stable 80kB/s (640kb/s) connection and it is enough to watch youtube 360p without any problems under Windows 7 on same machine. Youtube player and other video services work perfect, response on my clicks is instant. I also tried to watch youtube on very old 900MHz PIII desktop with same USB modem - no problem at all. However - under Debian (Iceweasel or Opera) - **all video players seem to work very inefficient and most of them freeze my browser for few seconds**. Pause button has lag too. I noticed that my browsers load diffrent youtube player (it's not HTML5 player like under windows). I also tried to connect my laptop via ethernet to windows computer with shared internet (from same USB modem), so this is not USB modem driver fault. My GPU is installed correctly and it seem to work with high performance.It deals with modern Gnome with fancy animations without performance problems, but I'm using Gnome Classic because modern one is too buggy when I run OpenGL app in windowed mode. **What can I do to improve youtube performance?** Im really confused that interned browsing on my relatively fast laptop works slower than old 900MHz PIII desktop with Windows XP.


title: Extract part of the first line of a file

text: I am trying to configure some external commands in Gedit3, for compiling LaTeX files. All works well, except for the following. I have a LaTeX document, consisting of many parts. Each file begins with               % mainfile: name_of_main_file.tex      So in bash I'm trying to extract the first line of each file, and from that line extract `name_of_main_file.tex` and compile that. So the question is: what is the quickest way of extracting `name_of_main_file.tex`, loading it into a variable, say `$MAINFILE`, so that then I can compile that?


title: Find and rename files adding part of the path to filename

text: I have a folder with two level of subfolders inside it. Inside the second subfolder, there is a jpg file. All the jpg have the same name: `cover.jpg` Example:               /home/user/folder001/folderAAA/cover.jpg     /home/user/folder002/folderBBB/cover.jpg     [...]     /home/user/folder999/folderZZZ/cover.jpg      I need to find (and copy to a new folder) all `cover.jpg` files and rename them adding to its filename (as prefix) the name of the first and second subfolder. Example:   After the intended operation, the content ot `/home/user1/newfolder` must be:               folder001_folderAAA_cover.jpg     folder002_folderBBB_cover.jpg     [...]     folder999_folderZZZ_cover.jpg


title: Failed Gummiboot install

text: I installed `Arch-Linux` and probably messed up with Gummiboot config. Is there a way to change `/boot/loader/entries/arch.conf` without doing whole installation process again?


title: DNS server design

text: Currently my company is deploying SIP phones in different locations from different boroughs. I've been asked to create static DNS records for each of the phones with the following format:   `phone-number.location.borough.sip.my-domain.com`. So far I have deployed two sites which belong to the same zone (db.sipphones). If I continue with this design I will have an immense zone which I believed is not optimal. An alternative would be to create a zone per location. I was wondering if anybody can advise the best design for this scenario.


title: Command to measure TLB misses on LINUX?

text: Could some one direct me to a command to measure TLB misses on LINUX, please? Is it okay to consider (or approximate) minor page faults as TLB misses?


title: Getopts option processing, Is it possible to add a non hyphenated [FILE]?

text: I'm using `getopts` for all of my scripts that require advanced option parsing, and It's worked great with `dash`. I'm familiar with the standard basic `getopts` usage, consisting of `[-x]` and `[-x OPTION]`. Is it possible to parse options like this?                dash_script.sh FILE -x -z -o OPTION      ## Or the inverse?      dash_script.sh -x -z -o OPTION FILE


title: Shell Script mktemp, what's the best method to create temporary named pipe?

text: I'm aware its best to create temporary files with `mktemp`, but what about named pipes? I have an idea, I'm sure it would work, but I would really like an expert opinion. I prefer things to be as POSIX compliant as possible, but Linux only is acceptable. Avoiding Bashisms is my only hard criteria, as I write in `dash`.


title: Extract Value from HTML

text:
I had another question based on a different html format. Problem is that my smartmeter is extremely slow in loading these HTMLs (5secs per file). Now I found another way with different html file....which is very fast in loading... Can you please give me a helping hand in how I could extract the two values for positive electric power Pplus and negative electric power Pminus...in this html file.... HTML is quite large but has this specific code arround the two values 21.0000 for Pplus and 5.0000 for Pminus.               ...     ...

     21.000

               ....     ....

     5.00000

           Thanks a lot. Norbert


title: What does fsck -p (preen) do on ext4?

text: I was reading a blog post about filesystem repair and the author posted a good question… `fsck -p` is supposed to fix minor errors automatically without human intervention. But what exactly will it fix when it's told to preen the filesystem? What errors will it fix, and what will cause it to stop and tell the user he or she must run fsck interactively? Is there a list of some kind? I've been Googling around and all I find is the man page, which doesn't really tell what `-p` will fix or what triggers the hands-on flag. I'm specifically interested in the ext4 filesystem.


title: Interpret an interpolated variable as a literal string in Perl regex

text: I am using `perl` to colorize a matched string               MATCH=aaa     printf "aaa\n/dev/aaa\nccc\n" | perl -pe "s/($MATCH)/\e[1;31m\1\e[0m/g"      This works well until I try to match a string containing special characters, e.g.               MATCH=/dev/     printf "aaa\n/dev/aaa\nccc\n" | perl -pe "s/($MATCH)/\e[1;31m\1\e[0m/g"      The reason is, when `bash` substitutes `$MATCH`, perl gets the following expression:               perl -pe "s/(/dev/)/\e[1;31m\1\e[0m/g"      I would need to backslash those `/` to make it work, i.e.               MATCH=\/dev\/     printf "aaa\n/dev/aaa\nccc\n" | perl -pe "s/($MATCH)/\e[1;31m\1\e[0m/g"          But I don't know what `MATCH` will contain. It could be anything, `+` or `(`. Is there a way to tell `perl` to treat the characters literally, not as an expression? # UPDATE: Using solution suggested by `Joseph R.` gives following error:               MATCH=/dev/     printf "aaa\n/dev/aaa\nccc\n" | perl -pe "s/\Q($MATCH)\E/\e[1;31m\1\e[0m/g"     Backslash found where operator expected at -e line 1, near ")\"     (Missing operator before \?)     Having no space between pattern and following word is deprecated at -e line 1.     syntax error at -e line 1, near "s/\Q(/dev/)"     Search pattern not terminated at -e line 1.      # UPDATE2: now I don't get any error, but there seems to be no match (there is no coloring):               # MATCH=/dev/ ; printf "aaa\n/dev/aaa\nccc\n" | perl -pe 's/(\Q$ENV{MATCH}\E)/\e[1;31m\1\e[0m/g'     aaa     /dev/aaa     ccc


title: Searching history forward after backward?

text: In bash, when I hit `Ctrl``r`, I can search the command history backward. If I would like to search forward again, what shall I do? I hit `Ctrl``s`, but it doesn't work. My bash is GNU bash, version 4.2.25(1)-release (i686-pc-linux-gnu)


title: Error during linux deepin installation

text: Yesterday i downloaded linux deepin latest version from linuxdeepin.com and create a bootable DVD disk for install that, But i get this error message during the installation(after selecting language):               nouveau E[Xorg[1925]] failed to idle channel 0xCCC0001      Please see the images below: ![enter image description here](http://i.stack.imgur.com/pNfFB.jpg) After that, a screen shown like this: ![enter image description here](http://i.stack.imgur.com/2AOrt.jpg) Please note that I installed deepin in VMware from my bootable DVD (no problem here).


title: Need advice in choosing a tiling WM

text: I've used GNOME's default window manager for some years, but now I want to try a tiling window manager. I want it to satisfy these two criteria:   1. WM must be lightweight   2. WM should not be complicated to configure


title: Easily updatable troubleshooting LiveUSB distro

text: I need easily updatable troubleshooting LiveUSB distro. By troubleshooting I mean that it should not have nothing fancy (X is used o display gparted etc.) but should have access to file archivers/undeleting etc. tools. Unfortunately most LiveUSB distros are modified LiveCD ones so they assume sequential and slow base device (as opposed to USB flash disk which is fast compared to CD, have 0 latency and have much number of writes to it). The only method of updating is overwriting the previous content. I'd like to have 'easy' package manager on distro to allow installing tools I need and from time to time an update which would not destroy any customisation. On the other hand I still would like to have autodetection scripts etc.


title: How to back up initial state of external backup drive?

text: I've picked up an HP Simplesave external drive. It comes with some fancy software that is of no use to me because I don't use Windows. Like many current consumer-targeted backup drives, the backup software is actually contained on the drive itself. I'd like to save the drive's initial state so that I can restore it if I decide to sell it. The backup box itself is somewhat customized: in addition to the hard drive device, it presents a CDROM-like device on `/dev/sr0`. I gather that the purpose of this cdrom device is to bootstrap via Windows autoplay the backup application which lives on the disk itself. I wouldn't suppose any guarantees about how it does this, so it seems important to preserve the exact state of the disk. The drive is formatted with a single 500GB NTFS partition. My initial thought was to use `dd` to dump the disk (`/dev/sdb`) itself, but this proved impractical, as the resulting file was not sparse. This seemed to be because the NTFS empty space is not filled with zeroes, but with a repeating series of 16 bytes. I tried gzipping the output of `dd`. This reduced to the file to a manageable size — the first 18GB was compressed to 81MB, versus 47MB to tarball the contents of the mounted filesystem — but it was very slow on my admittedly somewhat derelict Pentium M processor. The time to do that first 18GB was about 30 minutes. So I've resorted to dumping the disk state and partition data separately.   * I've dumped the partition state with              sfdisk -d /dev/sdb > sfdisk.-d.out        * I've also created a compressed image of the NTFS partition (the only one on the disk) with              ntfsclone --save-image --output - /dev/sdb1 | gzip -c > ntfsclone.img.gz      Is there anything else I should do to ensure that I can restore the precise original state of the drive?


title: Sending input to a screen session from outside

text: My scenario is this: I have a screen session running in a remote location. Inside this screen is a consoled-based program. When run without screen, this program starts in the terminal and accepts commands on its standard input. What I want is a way to remotely send a command to screen so that this command is received by the console program. Maybe like this: My PC -> SSH Send Msg Auto -> Screen Session -> Program (Run command received) So from a remote PC I can send via SSH commands to the screen which sends them to the program. The program accepts them and executes them.


title: What directories do I need to back up?

text: What are the directories one should back up, in order to have a backup of all user-generated files? From a vanilla debian install, I can do enough apt to get the packages that I want. So if I don't want to backup the entire system, where all in the filesystem do user-generated configuration and data files reside?


title: How can I kill a particular thread of a process?

text: $ ps -e -T | grep myp | grep -v grep       797   797 ?        00:00:00 myp       797   798 ?        00:00:00 myp       797   799 ?        00:00:00 myp       797   800 ?        00:00:00 myp      This shows the process `myp` with PID = 797 and four threads with different SPIDs. How can I kill a particular thread of the process without killing the whole process. I understand that it might not be possible at all in some cases when there are fatal dependencies on that particular thread. But, is it possible in any case? Is yes, how? I tried `kill 799` and the process itself was terminated. Now I am not sure this was because there were dependencies that made `myp` fail without the process `800` or because kill is simple not able to kill individual processes.


title: SSH'd into a computer, uptime / who / users report 0 users?

text: I'm ssh'd into a server. Why doesn't the server report it?               # uptime     21:54:28 up 13 days,  3:47,  0 users,  load average: 1.18, 1.11, 1.13     # users     # who      I'm not really sure I understand it correctly, but shouldn't they list 1 user, since I'm obviously logged in (as root)? Why it doesn't acknowledge me?


title: How to create virtual serial port?

text: Is there a common way (tool?) to create two serial ports through physical /dev/ttyS0? I have to simultaneously use both to communicate. I've seen 'Socat' but I can't understand how can I use it just for my purpose. If nothing 'ready-to-use' exists, I can develop in C++ by myself (worst case): can someone direct me on that libraries use for this purpose, general approach, risks and other useful things to know?


title: how to uniformly execute benchmarks on linux

text: I am doing project on adapting Linux for scalable multi core architecture. I am testing Linux's performance with benchmarks. When I am running the benchmarks in the system then other programs like background processes were running in the system. I think system load due to background processes is not fixed, as a result execution time of benchmarks may vary due to system's varying load. Then how to execute benchmarks uniformly. I already searched in net and asked researchers about it but not yet able to find solution of this problem. If possible please try to help me.


title: Linux: Total swap used = swap used by processes +?

text: So, I'm trying to do some investigation on where does swap use come from in a system with high swap usage:               # free                  total       used       free     shared    buffers     cached     Mem:        515324     508800       6524          0       4852      27576     -/+ buffers/cache:     476372      38952     Swap:       983032     503328     479704      Adding up swap used per process:               # for proc in /proc/*; do cat $proc/smaps 2>/dev/null | awk '/Swap/{swap+=$2}END{print swap "\t'`readlink $proc/exe`'"}'; done | sort -n | awk '{total+=$1}/[0-9]/;END{print total "\tTotal"}'     0       /bin/gawk     0       /bin/sort     0       /usr/bin/readlink     28      /sbin/xxxxxxxx     52      /sbin/mingetty     52      /sbin/mingetty     52      /sbin/mingetty     52      /sbin/mingetty     56      /sbin/mingetty     56      /sbin/mingetty     60      /xxxxxxxxxxx     60      /usr/sbin/xxx     84      /usr/sbin/xxx     108     /usr/bin/xxx     168     /bin/bash     220     /sbin/init     256     /sbin/rsyslogd     352     /bin/bash     356     /bin/bash     360     /usr/sbin/sshd     496     /usr/sbin/crond     672     /usr/sbin/sshd     12972   /opt/jdk1.6.0_22/bin/java     80392   /usr/libexec/mysqld     311876  /opt/jdk1.6.0_22/bin/java     408780  Total      Which gives a lower value for total used swap. Where is the remaining used swapspace? Is it vmalloc()'ed memory inside the kernel? Something else? How can I identify it? Output of meminfo:               # cat /proc/meminfo      MemTotal:       515324 kB     MemFree:          6696 kB     Buffers:          5084 kB     Cached:          28056 kB     SwapCached:     157512 kB     Active:         429372 kB     Inactive:        65068 kB     HighTotal:           0 kB     HighFree:            0 kB     LowTotal:       515324 kB     LowFree:          6696 kB     SwapTotal:      983032 kB     SwapFree:       478712 kB     Dirty:             100 kB     Writeback:           0 kB     AnonPages:      399456 kB     Mapped:           8792 kB     Slab:             7744 kB     PageTables:       1820 kB     NFS_Unstable:        0 kB     Bounce:              0 kB     CommitLimit:   1240692 kB     Committed_AS:  1743904 kB     VmallocTotal:   507896 kB     VmallocUsed:      3088 kB     VmallocChunk:   504288 kB     HugePages_Total:     0     HugePages_Free:      0     HugePages_Rsvd:      0     Hugepagesize:     4096 kB


title: perform ping test to change dns

text: I wrote this script to check if my dns server works fine or not, and if not change it. but it gives out error `./dns-ping.sh: line 15: ((: 3 < : syntax error: operand expected (error token is "< ")` where is the problem?               #! /bin/bash          loss_count=0     echo "--------------------------------------------------------------"     echo "++ DNS Ping Tester ++"     echo "--------------------------------------------------------------"     echo "please enter threshold:"     read $threshold     for timer in {1..2}         do             png=`ping -c 5 -q yahoo.com | grep -oP '\d+(?=% packet loss)'`             let loss_count=$png+$loss_count     done     let loss_mid=loss_count/12     if (($loss_mid < $threshold)); then     #   ifdown eth0         echo "less"     else         echo "nameserver 8.8.8.8" > /etc/resolv.conf     fi


title: How /var/lib/dpkg/lock works?

text: /var/lib/dpkg/lock is file that holding a lock when "A package manager is working". But how this system works? I have /var/lib/dpkg/lock everytime when I have Linux working. When I use one of package manager for dpkg I have it without any change. So I can't see it in action.


title: Listing both ls information and mount points of a directory?

text: On my Ubuntu Natty, typically all new drives inserted (e.g. USB Flash thumbdrives) are mounted under `/media`. So, on my system, I can do something like this:               $ mount | grep '/media'     /dev/sda6 on /media/disk1 type ext4 (rw,uhelper=hal,commit=0)     /dev/sda9 on /media/disk2 type ext4 (rw,nosuid,nodev,uhelper=udisks,commit=0)          # create proper dir     $ sudo mkdir /media/properdir     # creat symlink     $ sudo ln -s /tmp /media/          $ ls -la /media/     total 24     drwxr-xr-x  6 root          root          4096 2013-04-08 16:35 .     drwxr-xr-x 22 root          root          4096 2013-03-23 21:44 ..     drwxr-xr-x 36 username      username      4096 2013-04-06 19:15 disk2     drwxr-xr-x 11 username      username      4096 2012-04-10 12:24 disk1     drwxr-xr-x  2 root          root          4096 2013-04-08 16:35 properdir     lrwxrwxrwx  1 root          root             4 2013-04-08 16:35 tmp -> /tmp      ... that is, `ls` doesn't distinguish between a "proper" directory, and a mount point for a drive. What I'd like to have, is a tool output possible mount points as well, similar to how a symlink is shown by `ls`; example:               $ lsMOUNT -la /media/     total 24     drwxr-xr-x  6 root          root          4096 2013-04-08 16:35 .     drwxr-xr-x 22 root          root          4096 2013-03-23 21:44 ..     drwxr-xr-x 36 username      username      4096 2013-04-06 19:15 disk2 => /dev/sda9     drwxr-xr-x 11 username      username      4096 2012-04-10 12:24 disk1 => /dev/sda6     drwxr-xr-x  2 root          root          4096 2013-04-08 16:35 properdir     lrwxrwxrwx  1 root          root             4 2013-04-08 16:35 tmp -> /tmp      Does the proper `ls` have an option for something like this? If not, are there tools that can accept the same command line arguments as `ls`, but resolve potential mount points?


title: rsync: error starting client-server protocol

text: I have rsyncd running on both the systems . When I am trying to check the connection it giving me following error: **From host2:**               user@host2#rsync username@host1::share     password: [password]           @ERROR: auth failed on module share     rsync error: error starting client-server protocol (code 5) at main.c(1524) [Receiver=3.0.7]      **On host1:** I have following configuration               vim /etc/rsyncd.conf          max connections = 2     log file = /var/log/rsync.log     timeout = 300          [share]     comment = Public Share     path = /home/subhransu     read only = no     list = yes     uid = backuppc     gid = backuppc     auth users = backuppc     secrets file = /etc/rsyncd.secrets      **On host1**               tail /var/log/rsync.log          2013/04/09 03:47:15 [29179] forward name lookup for cust-198-154-126-179.corexchange.com failed: No address associated with hostname     2013/04/09 03:47:15 [29179] connect from UNKNOWN (198.154.126.179)     2013/04/09 03:47:18 [29179] auth failed on module share from unknown (198.154.126.179): unauthorized user      Note: `rsyncd.secrets` has correct `user:passwd` , No firewall issue.


title: Optimizing a shell script with long running while loop

text: I have written a shell script which has to do the following:   1. Capture session commands into one file.   2. Every individual command into separate file.   3. Mail every individual command file content based on certain criteria. As for my observation, the loop has to iterate minimum of 25,000 times. Now my problem is that it is taking more than 6 hours to complete all iterations. Below is the main part of the script which is taking long time to process.                if [ -s "$LOC/check.txt" ]; then              while read line; do                 echo -e " started processing $line at `date` " >> "$SCRIPT_LOC/running_status.txt"                 TST=`grep -w $line $PERM_LOC/id_processing.txt`                 USER=`echo $TST | grep -w $line | awk -F '"' '{print $10}'`                 HOST=`echo $TST | grep -w $line | awk -F '"' '{print $18}'`                 ID=`echo $TST | echo $line | tr -d '\"'`                 IP=`echo $TST | grep -w $line | awk -F '"' '{print $20}'`                 DB=`echo $TST | grep -w $line | awk -F '"' '{print $22}'`                 CONN_TSMP=`echo $TST | grep -w $line | awk -F '"' '{print $2}'`                      if [ -z "$IP" ]; then                         IP=`echo "$HOST"`                 fi                      if [ "$USER" == "root" ] && [ -z $DB ]; then                          TARGET=/data1/sessions/root_sec                          CMD_TARGET=/data1/commands/root_commands                          FILE=`echo "$ID-$CONN_TSMP-$USER@$IP.txt"`                 else                          TARGET=/data1/sessions/user_sec                          CMD_TARGET=/data1/commands/user_commands                          FILE=`echo "$ID-$CONN_TSMP-$USER@$IP.txt"`                 fi                      ls $TARGET/$FILE                 If [ $? -ne 0 ]; then                          echo $TST | awk -F 'STATUS="0"' '{print $2}'| sed "s/[</>]//g" >> "$TARGET/$FILE"                          echo -e "\n" >> "$TARGET/$FILE"                  fi                       grep $line  $LOC/out.txt  > "$LOC/temp.txt"                       while read val; do                           TSMP=`echo "$val" | awk -F '"' '{print $2}'`                           QUERY=`echo "$val" | awk -F 'SQLTEXT=' '{print $2}' | sed "s/[/]//g"`                            echo " TIMESTAMP=$TSMP " >> "$TARGET/$FILE"                            echo " QUERY=$QUERY " >> "$TARGET/$FILE"                            RES=`echo "$QUERY" | awk {'print $1'} | sed 's/["]//g' `                            TEXT=`grep "$RES" "$PERM_LOC/commands.txt"`                            if [ -n "$TEXT" ]; then                                    NUM=`expr $NUM + 1`                                    SUB_FILE=`echo "$ID-$command-$NUM-$TSMP-$USER@$IP.txt"`                                    echo -e "===============\n" > "$CMD_TARGET/$SUB_FILE"                                    echo "FILE      =   \"$SUB_FILE\"" >> "$CMD_TARGET/$SUB_FILE"                                     ### same way append 6 more lines to $SUB_FILE                                                      SUB=`echo "$WARN_ME" | grep "$command"`                                     if [ "$command" == "$VC" ]; then                                           STATE=`echo " very critical "`                                     elif [ -z "$SUB" ]; then                                           STATE=CRITICAL                                     else                                            STATE=WARNING                                     fi                                          if [ "$USER" != "root" -a "$command" != "$VC" ]; then                                            mail command &                                     elif [ "$USER" == "root" -a -z "$HOST" ]; then                                            mail command &                                     elif [ "$USER" == "root" -a "$command" == "$VC" ]; then                                            mail command &                                     else                                            echo -e "some message \n" >> $LOC/operations.txt                                     fi                            fi                  done < "$LOC/temp.txt"         done < "$LOC/check.txt"      fi      Can any one help me how to optimize this code either by dividing or by changing logic or by using functions or by anything else? Here I have to use a shell script only and the server on which the script will be executed should not take more than 3GB of RAM to process it. Any help is very very useful.


title: Can I get the opposite of `diff -q` -- matching identical files without printing their contents

text: I have a number of files in a directory, and I want to check that they are all unique. For simplicity, let's say I have three files: `foo.txt`, `bar.txt` and `baz.txt`. If I run this loop, I will check them all against each other:               $ for f in ./*; do for i in ./*; do diff -q "$f" "$i"; done; done     Files bar.txt and baz.txt differ     Files bar.txt and foo.txt differ     Files baz.txt and bar.txt differ     Files baz.txt and foo.txt differ     Files foo.txt and bar.txt differ     Files foo.txt and baz.txt differ      For the hundreds of files I want to deal with, this would become pretty unreadable; it would be better to list the files that _do_ match, and then I can look over the list quickly and make sure that files are only matching themselves. From the manpage, I would have thought that the `-s` option would accomplish this:               $ for f in ./*; do for i in ./*; do diff -s "$f" "$i"; done; done     Files bar.txt and bar.txt are identical     Files baz.txt and baz.txt are identical     Files foo.txt and foo.txt are identical      ...however, in fact it _also_ prints out the whole contents of any files that differ. Is there any way to suppress this behaviour, so I only get the behaviour above? Alternatively, is there some other tool that can accomplish this?


title: Privileges for jenkins at apache's folder

text: I'm having issue similar to this: How to copy files as Jenkins "post build" action if i don't have privileges to destination directory I'm willing to move/copy/rsync files from jenkins workspace to > /var/www/app with rights setted to > apache: **apache** **I've added jenkins to group** **apache** , but the instance of jenkins cannot copy files to /var/www/app. I've also tried with setting privileges of /var/www/app to apache:jenkins but still, Jenkins keep spitting out error: Permission denied or Operation not permitted PS: Forgot to add OS is centOS ;) EDIT 1: This is log from jenkins script runnig: > [workspace] $ /bin/sh -xe /tmp/hudson1379987233097some_more_numbers.sh + sh > /path_to_sh_script/script.sh sending incremental file list > > application/ > > rsync: failed to set permissions on "/var/www/app/application": Operation > not permitted (1) And this is the script itself :) > #!/bin/bash > > rsync -avzh /path/to/jenkins/jobs/app/workspace/default/application > /var/www/app ; > > rsync -avzh /path/to/jenkins/jobs/app/workspace/default/library /var/www/app > ; > > rsync -avzh /path/to/jenkins/jobs/app/workspace/default/public /var/www/app > ;


title: py3compile error - Unable to get the locale encoding

text: After reinstalled the python3.2, I got the error as below when call `py3compile`:               Fatal Python error: Py_Initialize: Unable to get the locale encoding     LookupError: no codec search functions registered: can't find encoding     Aborted      I know it may be the problem of missing environment variable. But I have no idea of how to fix it. I checked the `env` output and didn't find any PYTHONXXX variables.


title: What does $# mean in shell?

text: What does `$#` mean in shell? I have code such as               if [ $# -eq 0 ]     then      I want to understand what `$#` means, but Google search is very bad for searching these kinds of things.