title: Ubuntu blocks access to services when not logged in

text: I'm not really sure what's going on here. I have the following:   1. A fresh install of Ubuntu 12.04 LTS.   2. Jira 6.1.2 installed as per instructions from Atlassian.   3. Confluence 3.5.13 installed as per instructions from Atlassian. What's happening is that as long as I maintain an active SSH session with the server I can access Jira and Confluence just fine. From both the internal network and externally. The problem, however, is that as soon as I disconnect the SSH session I lose the ability to access both Jira and Confluence. It's just gone, poof. The browser displays a blank page/404 error. As soon as I log in again over SSH, the services are accessible again (I don't need to restart them or anything after logging back in...just authenticate via SSH and everything is magically working correctly again). I also have an Apache2 instance running on the same machine. This one works just fine even when I'm not logged in via SSH. It seems like it's only Jira/Confluence that are affected here. Any ideas on what might cause this, or how to fix it?


title: Where can I find the historical source code of the Linux sources

text: I want to do research on the evolution of Linux. Therefore it would be nice if I could download the sources of Linux at several moments in time (from 1991 till now). Is there a site where one can find those sources? Similar sites for other Unix based operating systems are also welcome.


title: remove trailing zeros in awk not working. syntax error

text: regex = "\\.*0+$";     subst = "";     system("echo "id "| awk '{sub(\\.*0+$," subst"); print}'");      It is giving the following error:               awk: cmd. line:1: {sub(\.*0+$,); print}     awk: cmd. line:1:      ^ backslash not last character on line      I tried this one as well               system("echo "id "| awk '{sub("regex"," subst"); print}'");      and This is also no worky.                str="echo " id " | awk '{sub(" regex  "," subst "); print;}'" ; str | getline check;      This is giving me same exception               awk: cmd. line:1: {sub(\.*0+$, ); print}     awk: cmd. line:1:      ^ backslash not last character on line      But, on the command line, this function is working fine.               echo 444000 | awk '{sub("\\.*0+$",""); print}' -> 444


title: Bash command not found error

text: Why would the following script give following errors :               ./check1.sh: line 10: Hi,: command not found       ./check1.sh: line 21: syntax error: unexpected end of file      check1.sh:               #!/bin/bash               subj="host `hostname`"     healthcheckstatus=$(curl -s -o /dev/null -w '%{http_code}' http://localhost)          body="Hi, Application is up"     body1="Hi, Application is down"          mailbody=$([ "$applicationstatus" == 200 ] && $body || $body1)               if [ $healthcheckstatus != "200" ]     then     mail -s "$subj" me@domain.com <<EOS     `echo -e $mailbody`     EOS     fi     echo "email subject ::$subj"     echo "email body ::$mailbody"


title: Adjust pane size in vim

text: I know I can use `:sp` or `:vsp` to open files in vim in splitted panes. But how can I increase/decrease the size of each pane?


title: apt-get update: How to check for GPG errors when using scripts?

text: When running.               sudo apt-get update      For example something like this could happen.               W: GPG error: http://deb.torproject.org wheezy Release: The following signatures were invalid: KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681      (This question is not about this particular example warning. It has already been reported.) Exit code.               echo $?     0      Exit code 0 is problematic for automated use in scripts, where success is expected. This is a bug in Debian's apt-get:   apt: Provide meaningful exit codes for gpg failures How to notice GPG errors in scripts when the exit code is not reliable?


title: Is there an advantage in using ksh over zsh?

text: Or are there any advantages for using ksh over zsh? Would any specific commands not execute successfully across the shells or are the major differences not command related, but something else?


title: eth0 and wlan0 set-up problem in Linux Mint

text: I had a perfectly working wi-fi connection on my Mint-KDE PC. Recently, I brought a Synology NAS and after some research figured that I need to set my eth0 to static IP for it to connect to NAS via ethernet cable. So, I added this line to my `/etc/network/interfaces` file:               auto eth0     iface eth0 inet static     address 192.168.1.99     netmask 255.255.255.0     gateway 192.168.1.100      Now, after I restarted my PC, my ethernet connected to Synology fine but I had a new problem, my internet connection is gone. It says that the connection 'my_wifi_name' is connected but I have no internet, no response even when I do `ping google.com` in the terminal. (`ping: unknown host google.com`) This is my ifconfig response BEFORE changing my `/etc/network/interfaces` file: (With this setting the LAN cannot connect to NAS, it gives me `Connection 'Wired Connection 1' deactivated`.)               $ ifconfig     eth0      Link encap:Ethernet  HWaddr c8:60:00:de:b7:da                 inet6 addr: fe80::ca60:ff:fede:b7da/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:6 errors:0 dropped:0 overruns:0 frame:0               TX packets:63 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:3540 (3.5 KB)  TX bytes:12967 (12.9 KB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:651 errors:0 dropped:0 overruns:0 frame:0               TX packets:651 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:85658 (85.6 KB)  TX bytes:85658 (85.6 KB)          vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01                 inet addr:172.16.82.1  Bcast:172.16.82.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:104 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08                 inet addr:192.168.156.1  Bcast:192.168.156.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:105 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          wlan0     Link encap:Ethernet  HWaddr 64:70:02:f0:b9:7f                 inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::6670:2ff:fef0:b97f/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:627 errors:0 dropped:0 overruns:0 frame:0               TX packets:626 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:395824 (395.8 KB)  TX bytes:110123 (110.1 KB)      This is my ifconfig response AFTER changing my `/etc/network/interfaces` file: (With this setting both the wi-fi and LAN connects to NAS, but internet is unavailable despite the successful wi-fi connection status.)               $ ifconfig     eth0      Link encap:Ethernet  HWaddr c8:60:00:de:b7:da                 inet addr:192.168.1.99  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::ca60:ff:fede:b7da/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:6 errors:0 dropped:0 overruns:0 frame:0               TX packets:140 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:3540 (3.5 KB)  TX bytes:17523 (17.5 KB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:894 errors:0 dropped:0 overruns:0 frame:0               TX packets:894 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:88248 (88.2 KB)  TX bytes:88248 (88.2 KB)          vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01                 inet addr:172.16.82.1  Bcast:172.16.82.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:61 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08                 inet addr:192.168.156.1  Bcast:192.168.156.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:61 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          wlan0     Link encap:Ethernet  HWaddr 64:70:02:f0:b9:7f                 inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::6670:2ff:fef0:b97f/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:60 errors:0 dropped:0 overruns:0 frame:0               TX packets:59 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:3465 (3.4 KB)  TX bytes:11879 (11.8 KB)      What am I doing wrong here? I have no clue, no help from googling either. Thanks. EDIT: This is my ip route command output:               $ ip route     default via 192.168.1.1 dev wlan0  proto static      172.16.82.0/24 dev vmnet1  proto kernel  scope link  src 172.16.82.1      192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.4  metric 9      192.168.156.0/24 dev vmnet8  proto kernel  scope link  src 192.168.156.1       Also, I chose the address and gateway in my `/etc/network/interfaces` randomly, I had it as follow at first but changed it to another value as shown in original question in hopes that it might make it work. I clearly have no idea what those values signify, I think those are the static ip that'll be associated with eth0 and my Synology will read it and lock into that static address. `/etc/network/interfaces' file used at first attempt:               auto eth0     iface eth0 inet static     address 192.168.1.2     netmask 255.255.255.0     gateway 192.168.1.1


title: How to speed up or get rid boot with network manager on systemd?

text: Network manager is the one thing that holds my system boot time from becaming really barelly existing. I'm connecting to wi-fi. My boot chain indicates what's wrong with network manager:               graphical.target @12.494s     └─multi-user.target @12.494s       └─ntpd.service @12.198s +295ms         └─network.target @12.172s           └─NetworkManager.service @5.914s +6.258s             └─basic.target @5.913s               └─timers.target @5.912s                 └─systemd-tmpfiles-clean.timer @5.912s                   └─sysinit.target @5.912s                     └─systemd-update-utmp.service @5.861s +50ms                       └─systemd-tmpfiles-setup.service @5.834s +26ms                         └─local-fs.target @5.833s                           └─opt.mount @5.712s +120ms                             └─systemd-fsck@dev-sda7.service @5.303s +395ms                               └─dev-sda7.device @5.302s      When I move to static network boot with wpa_supplicant, time cuts by reasonatble amount. However I want to use Network manager after boot anyway. Is there any way to make network manager way faster (Wicd is not helping it has even worse boot time), or get rid/substitute it in boot sequence and load it latter (probably only after GUI was loaded, for example). This is my entire blame table, with all services:                 6.258s NetworkManager.service       4.501s gdm.service       2.436s thermald.service       2.429s systemd-logind.service       1.297s systemd-vconsole-setup.service       1.125s systemd-binfmt.service       1.120s kmod-static-nodes.service       1.042s colord.service        913ms systemd-modules-load.service        851ms systemd-remount-fs.service        765ms systemd-fsck@dev-sda6.service        578ms sys-kernel-debug.mount        576ms dev-hugepages.mount        576ms polkit.service        568ms dev-mqueue.mount        523ms systemd-udev-trigger.service        519ms systemd-sysctl.service        464ms wpa_supplicant.service        438ms upower.service        405ms tmp.mount        395ms systemd-fsck@dev-sda7.service        352ms accounts-daemon.service        295ms ntpd.service


title: 'fast interrupts' in Linux

text: as far as I know, Linux has 'fast interrupts', those that were requested with SA_INTERRUPT flag; fast interrupts are executed with all other interrupts disabled on the current CPU. But how does it differ from the normal interrupt handler behavior (where)?


title: Calendar to learn Linux?

text: I've been sifting through websites and forums trying to locate a way to schedule learning in a calendar type of way and have had little success. Is there a calendar or schedule that would do something like: April 12 (or day 1) - learn HAL, /proc and udev April 13 (or day 2) learn - lsusb, lspci so that I could keep an organized and driven approach to learning Linux? EDIT: does there exist a calendarized curriculum for LPIC/Linux+ learning?


title: Carriage Return and Line Feed bit streams in a binary file during TFTP upload in ASCII mode

text: In case of TFTP, one can choose between "ASCII" or "octet" mode. As I have understood, 00001010(new-line) or 00001101(carriage return) bit streams in a binary file will get some sort of special treatment in ASCII mode? However, I created a file containing those characters:               root@A58:~# printf '\n' | xxd | xxd -r > bfile; printf '\r' | xxd | xxd -r >> bfile; printf 'A' | xxd | xxd -r >> bfile     root@A58:~# xxd -b bfile     0000000: 00001010 00001101 01000001                             ..A     root@A58:~#       ..and when I uploaded this file from TFTP client to TFTP server using both "octet" and "netascii" modes, the file reached the TFTP server in same condition and had exactly the same content:               T42 ~ # cmp /srv/tftp/reverse_ascii /srv/tftp/reverse_binary      T42 ~ #       Did I do something wrong? Or how should ASCII mode mangle the binary data?


title: Make hunspell work with emacs and german language

text: I want to make `hunspell` work with emacs24 and a german dictionary on a ubuntu 13.04-box. To do so I installed `hunspell` and `hunspell-de` and added the following to my `.emacs` file:               (setq ispell-program-name "hunspell")     (setq ispell-dictionary "deutsch8")      When I open a file in emacs and start `flyspell-buffer` I get `Starting new Ispell process [[hunspell::deutsch8]]` but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config. Without the second line it works, but only for english texts. So what's the best way to setup `hunspell` for `emacs24` with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?


title: Testing remote TCP port using telnet by running a one-line command

text: I have numerous linux boxes with a very limited set of commands and disk space. But it has the `telnet` command on it. I remotely connect to each of these probes (programmatically) and issue one line linux commands through SSH. I need to a command to connect to a specific machine, using telnet, **and then disconnect right away**. I can do all that, but the **disconnection right away** part. Telnet opens some sort of a console, or terminal and I can't figure out a one-line command to run the telnet command and then disconnect right away. If I do that, I can easily parse the textual output for error messages for not being able to connect to the machine on the specified port and that's exactly what I am looking for. So how can I run a one-line command to connect to a machine using telnet and disconnect afterwards ?


title: How to only output [a-z;A-Z;0-9;|] chars with ksh?

text: How can I "whitelist"/output only the (ENglish) a-z;A-Z;0-9;| chars and space in ksh/OpenBSD 5.3?               $ echo 'ASDF"`date`ew � kd A | A'     ASDF"`date`ew � kd A | A     $ echo 'ASDF"`date`ew � kd A | A' | MAGIC     ASDFdateew  kd A | A      So **Q:** MAGIC is needed :) UPDATE:               echo 'a|d' | LC_ALL=EN tr -dc '[:alnum:][:space:]|'     a|d      This works in console, but If I put it in a CGI script then it outputs this:               a7Cd      Why?


title: Can a linux user change their password without knowing the current password?

text: I'm setting up a few `ubuntu` boxes, and using opscode's `chef` as a configuration tool. It would be fairly easy to install public keys for each user on each of these servers, and disable password authentication. However, the users should also have `sudo` privileges though, which by default requires a password. If I want to use the users' public keys as a method of access management and allow the users `sudo` privileges, does that mean I should also set up the users with `NOPASSWD: ALL` in `visduo`, or **is there a way that a user can change their own password if they only have public key authentication?**


title: is it safe to backup ext4 partition with partimage , which is detected as a ext3 partition

text: I use `partimage` to backup my `ext4` partition, but during backup, the partition was detected as an `ext3` partition. So I'm wondering if this can cause something bad.


title: Can I avoid writing to the screen until a couple seconds before X11 is initialized?

text: On an embedded device running Linux, I am writing to the monitor from the bootloader (U-Boot) to display a given logo. Once the linux kernel is loaded, however, it clears the screen until X11 is initialized. Is there any way I can avoid writing to the screen until shortly (a couple seconds) before X11 is initialized? Having an unsightly blank screen for ten seconds is bound to scare some end-users.


title: Using sed to process passwd file

text: I am trying to learn sed, but I'm having a lot of trouble. What I am trying to do is process my passwd file using a bash script with sed commands to do the following: For every user with group ID 20000, replace their GID in the file with 2000x, where x is the order of the first letter in the user's username (ie: a is 1, b is 2, etc.) Also, for every user whose default shell is bash, change their group to bash, and for those with shell tcsh, change their group to tcshgroup. I have done the above work in awk (much easier to work with I've found), but I don't even know where to start with sed. Any help is much appreciated. Here is part of the passwd file:               speech-dispatcher:x:108:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh     colord:x:109:117:colord colour management daemon,,,:/var/lib/colord:/bin/false     lightdm:x:110:118:Light Display Manager:/var/lib/lightdm:/bin/false     avahi:x:111:120:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false     hplip:x:112:7:HPLIP system user,,,:/var/run/hplip:/bin/false     pulse:x:113:121:PulseAudio daemon,,,:/var/run/pulse:/bin/false     saned:x:114:20000::/home/saned:/bin/tcsh     mmccormick:x:1000:20000:owner,,,:/home/mmccormick:/bin/bash      Ideally I'd pick out field 4 of each line to get the group ID and field 7 for the shell, but again, I'm not aware of a way to do that in sed. Thanks in advance.


title: How to bring back `irb` back to teminal screen

text: I run a program by `irb` that have `rescue` and `retry` statement. Accidentally, I closed the irb running terminal. But process itself is still alive like this.               ps ax | grep irb     17749 pts/0    S+     0:00 grep --color=auto -i irb     28510 ?        Sl     0:37 irb                I can kill the process by `kill 28510`, but if possible I want to bring the process back to terminal screen. Is there way to do it?


title: Installation problem with python-software-properties

text: I need to install the last version of node.js but my system has in repository older version. I need to add new ppa source. I followed this tutorial **Question** \- when I install "python-software-properties" package:               sudo apt-get install python-software-properties      program "add-apt-repository" is not installed (nor apt-add-repository):               root@vm7590:~# add-apt-repository     The program 'add-apt-repository' is currently not installed.  You can install it by typing:     apt-get install python-software-properties      and               root@vm7590:~# apt-add-repository     The program 'apt-add-repository' is currently not installed.  You can install it by typing:     apt-get install python-software-properties      but program "python-software-properties" is already installed.               root@vm7590:~# sudo apt-get install python-software-properties     sudo: unable to resolve host vm7590     Reading package lists... Done     Building dependency tree     Reading state information... Done     python-software-properties is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      **What am I doing wrong?** Is there some another method hot to add a ppa source? My system is as follows:               root@vm7590:~# uname -a     Linux vm7590 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


title: Cut down the installed space?

text: My system: Debian 6.04, `sda` is working disk, `sdb` is my USB disk.   I installed Debian onto the USB drive this way, to edit grub file on `sda`,   `nano /boot/grub/grub.cfg` to add the new lines               menuentry 'Debian 6.0 from hard disk to install into usb' {         set isofile="(hd0,6)/debian.iso"         loopback loop $isofile         linux (hd0,6)/vmlinuz         initrd (hd0,6)/initrd.gz     }      where the `vmlinuz` and `initrid.gz` is from `ftp.debian.org/debian/dists/testing/main/installer-i386/current/images/hd- media/`, and the `debian.iso` is from `http://www.debian.org/distrib/netinst`. When I now reboot, I can go into install UI, to finish my installation on USB.   The problem is: my USB is 4GB, the iso image is only 46MB -- but it uses 3GB to install, so there is so little space left, which is strange, since the iso is only 46MB...? How can I cut down the installed space?


title: centos primary/secondary nameserver setup

text: I am new to Linux/unix and would like to know how to setup my (ve) server to host my website. The (ve) server will have centos 5.5 installed with a LAMP stack. I am specifically looking for a way to setup the domain/fqdn to point my registrar (http://co.za/) to my server IP. For example: www.mydomain.co.za takes me to my website. What do I need to install/configure to get the above up and running?


title: Prevent directory permission change (or cronjob to work around)

text: I have a HostGator dedicated server running CentOS. I have a folder on one user's account where I want all users to be able to have read access, so we keep it chmod'd to 755. HG has a script that runs and changes these permissions. I had them disable that script, but they also changed an attribute so that the folder was append only, making it impossible to delete a file. They gave me the command to toggle that attribute, but I don't want to have to open a shell every time I want to delete a file from FTP. Is there another way of making it so that I can use that directory like normal, but prevent the permission from being changed? **EDIT** : After a little back and forth, HG and I have come up with this cronjob that isn't quite right yet. I have an open ticket with them, but sometimes this awesome community is faster. `if [[ "stat -c "\%a" /home/user/folder" != "755" ]]; then echo -e "Perm Changed\n" $(stat /home/user/folder) "\n" | mail -s "cron" addy@email.com; chmod 755 /home/user/folder; fi` The conditional statement isn't correct and I suspect the quotation marks are out of place but I don't know enough of this syntax to be sure. Can anyone spot the error here? It is supposed to check the permission of the folder. If they are not 755, then send an email and change the permissions. What I get is as if the condition is alway true.


title: On Debian (64-bit), how do I install glibc that I built from source?

text: When I tried to do this, my system broke, with every program immediately segfaulting. I believe it's because it installed a new version of `ld- linux-x86-64.so.2` in `/lib64` but when a program was loaded it would find the old version of `libc.so.6` in `/lib/x86_64-linux-gnu` rather than the new version in `/lib64`. (Apparently ld and libc have to match?) I tried putting `/lib64` at the top of `/etc/ld.so.conf.d/x86_64-linux- gnu.conf` and then running `ldconfig`. However, for some reason this didn't fix anything.


title: Bash (single line): Execute 2nd command if first succeeds, execute 3rd if it doesn't?

text: I want to execute two commands one after another via SSH. I don't have an interactive shell. The second command should only execute if the first one succeeds, but the line is inside a script, so I'd like some user-friendly feedback if the second command fails to execute this way. After that, the rest of the script should continue executing, so `exit`, etc. is not an option here. I know I can use the boolean operator `&&`, e.g. `foo && bar` to prevent `bar` from executing if `foo` fails, and `bar || baz` to execute `baz` only on `bar`'s failure. However I am a little confused as to how these work in conjunction with each other. To sum it up: _(Executed via SSH without an interactive shell)_   1. Execute `foo`   2. Execute `bar` ONLY if `foo` succeeds   3. Execute `baz` ONLY if `foo` fails and prevents the execution of `bar` `ssh user@host "foo && bar || baz"` Is this a correct way to do what I just described?


title: Why use linux, and which one should I use?

text: maybe this question may seem a little bit odd here, but I would like to ask it to people that actually got some knowledge and use this system. Should I use linux? If so, which one would you consider best, and why? I'm currently using win 7 64-bit. On my PC, I mainly play some games(like SC2, DayZ, and some other games, from steam), search web, listen to music, and I'm learning C++. I know many people use Linux, but I'm not sure why and if it's good for me. Is there anything superior to Windows, except for price?


title: Is there any small linux distro for ARM NAS?

text: I want a small linux distribution, that includes the following open source packages: busybox samba afpd avahi pureftpdftp minidlna transmission I thought, I can compile one from sources, but it's too complicated for me... I have a Dlink DNS-325 NAS, but the built-in firmware doesn't do everything what I want and with FFP it's a little bit slow.


title: VIM see regular expressions matches as you type

text: If I type `/regex` then the cursor temporarily jumps to the first match and all matches are highlighted. This updates as I type. Is it possible to get this behavior when I'm getting ready to make a substitution? For instance, when I'm working on a complicated regular expression `:%s/\<regex\>/`, I would like to know what is matching before I pull the trigger and change everything. Any way to do it?


title: group file and everything related to it

text: I'm quite new to *nix OS. I understand the format and usage (at least what the man pages says) of the `/etc/group` file. One day I was trying to replace my group file with a backup copy. I changed the file name to `group.old` and then all accounts in my machine lost _root_ access. I had to go to single user mode to fix it. It seems I need a in-depth lesson on this group and the whole UNIX account thing. Can any one give me a link or share your learning experience with me?


title: Output to stdout and at the same time grep into a file

text: I have a script that outputs text to `stdout`. I want to see all this output in my terminal, and at the same time I want to filter some lines and save them in a file. Example:               $ myscript     Line A     Line B     Line C          $ myscript | grep -P 'A|C' > out.file          $ cat out.file     Line A     Line C      I want to see output of first command in terminal, and save the output of the second command in a file. At the same time. I tried using `tee`, but with no result, or better, with **reversed result.**


title: Arch Linux: How to ignore certain packages for certain repositories using pacman?

text: I have an unofficial repository called `haskell-core`. I want to blacklist every haskell package in `extra` and use the packages from `haskell-core` instead. I don't want to use haskell packages from `extra` and I need it to be low maintenance. Is this possible? **EDIT:** Pacman still installs haskell packages from `extra` if they are newer.


title: I accidentally formatted the wrong volume - is it possible to restore the previous Ext4 filesystem?

text: I know that a similar question has already been asked. This morning I accidentally formatted the wrong volume, containing mostly video files (about 30GB each). I am currently trying to restore the files with Photorec, however it does not seem to work very well - all restored files are corrupted. The volume is a Cryptsetup Luks ext4 volume (however not reformatted with LuksFormat, just mkfs.ext4) Is it somehow possible to recover the old superblocks/journals? (And if yes, would that actually help restoring the old filesystem?)


title: ls: how do I list directories sorted by timestamps of the files it contains

text: How do I list directories by their access time in the sense that some new files/directories are created (say, directories containing the most recently created files).


title: How can I disable the user list login screen in Gnome 3 on Fedora 16 or 17?

text: Our login screen requirements include a warning / disclaimer and a basic login, showing just a username and password field. Sadly, Gnome 3 seems to be ignoring the `org.gnome.login-screen.disable-user-list` checkbox presented by `dconf-editor`. Can you disable the list of users displayed prior to login in Gnome 3 GDM?


title: While using ssh with Gui script it is giving error

text: When I'm using the line below in script:               ssh -Y user@host /home/user/xxx  (xxx is gui script will open GUI window)      It is giving me error as below:               xauth: not found.     stty: : Not a typewriter     X11 connection rejected because of wrong authentication.     X connection to 10.100.2.23:10.0 broken (explicit kill or server shutdown).       One solution I found on the net was to edit `/etc/ssh/sshd_config` file and set:               X11Forwarding yes      But I can't open `sshd_config` file:               grep X11Forwarding /etc/ssh/sshd_config     grep: can't open /etc/ssh/sshd_config      But if I run this command:               ssh -Y user@host`      After reached at the new host if I try to execute:               xxx  (xxx is gui script will open GUI window)       It works fine. I have to use it in script only. Any suggestions?


title: How to install Ubuntu from a USB key using syslinux?

text: I'm making a bootable USB key for myself, and one function of it is to install Ubuntu. I have downloaded the ubuntu-11.10-desktop-i386.iso file. There is a pretty good method for installation of Red Hat from a USB drive, but the problem is, when it comes to Ubuntu, what should the syslinux.cfg file be? I used `syslinux -d /boot/syslinux /dev/sdb1` and put vmlinuz and initrd.img inside it. Is the following item of syslinux.cfg correct?               LABEL InstallUbuntu     MENU LABEL Ubuntu 11.10 Install     KERNEL /boot/syslinux/vmlinuz     APPEND linux load_ramdisk=1 initrd=/boot/syslinux/initrd.img method=hd:sdb1:/


title: Different redirection styles with netcat and tee giving different results

text: In trying to trace a simple HTTP GET request and its response with `nc`, I'm running into something strange. This, for example, works fine: the `in` file ends up containing the HTTP GET request and the `out` file the response.               $ mkfifo p     $ (nc -l 4000 < p | tee in | nc web-server 80 | tee out p)&     [1] 8299     $ echo "GET /sample" | nc localhost 4000     This is contents of /sample...     $ cat out     This is contents of /sample...     $      However, if I replace the `tee out p` above with `tee out >p`, then the `out` file turns out to be empty.               $ (nc -l 4000 < p | tee in | nc web-server 80 | tee out > p)&     [1] 8312     $ echo "GET /sample" | nc localhost 4000     $ cat out     $       Why should this be so? **EDIT:** I'm on RHEL 5.3 (Tikanga).


title: /dev/tcp not present in Linux

text: I am porting C/pro*c code from UNIX to Linux. The code is:               #define __NFDBIT       (8 * sizeof(unsigned long))     #define __FD_SETSIZ    1024     #define __FDSET_LONG   (__FD_SETSIZ/__NFDBIT)     typedef struct {         unsigned long fds_bits [__FDSET_LONG];     } __ernel_fd_set;          typedef __ernel_fd_set           fd_set_1;     int main()     {         fd_set_1 listen_set;         int listen_sd;         int socket_id;         FD_ZERO(&listen_set);         socket_id = t_open("/dev/tcp", O_RDWR|O_NONBLOCK, (struct t_info *) 0);         if ( socket_id <0 )         {             exit(FAILURE);         }         return 0;     }      In UNIX the value of socket_id is `> 0` in Linux it is `-1`. Reason is in UNIX, there is a `/dev/tcp`. This is not present on Linux. Also in UNIX this `tcp` file is character special file which is different from normal file. Is there any way to create same character special file in Linux as in UNIX or how to proceed this further?


title: How to make netcat use an existing HTTP proxy

text: I can access a web page just fine by directly hitting my web server as follows:               $ echo "GET /sample" | nc web-server 80     This is contents of /sample...     $      Now, I would like netcat to go via a Squid HTTP proxy (listening on port 3128), much like I can configure my Firefox browser via its proxy preferences and have it go via an HTTP proxy. I tried the following, but it did not work:               $ echo "GET /sample" | nc -x squid-proxy:3128 web-server 80         <Seemed to be blocked FOREVER on input, so I killed it.>     <Ctrl-C>     $      * * * Note: I'm using RHEL 5.3 version of netcat that has the following options:               $ nc --help     nc: invalid option -- -     usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]       [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]       [-x proxy_address[:port]] [hostname] [port[s]]      Excerpt from the man page of `nc`:                EXAMPLES         <snip>      Connect to port 42 of host.example.com via an HTTP proxy at 10.2.3.4, port 8080.       This example could also be used by ssh(1); see the ProxyCommand directive in      ssh_config(5) for more information.            $ nc -x10.2.3.4:8080 -Xconnect host.example.com 42      Now, because mine is not an ssh/SSL usecase, I'm not sure how to use the `-x` / `-X` options, or even whether I should be using them at all! If there's more than one way to achieve the above goal (namely, routing netcat traffic via an HTTP proxy), then I would greatly appreciate if you could share them all. Many thanks in advance.


title: pdsh command failed with connection refused

text: I'm able to remote login the target host with ssh. But when I execute a command through `pdsh`, it fails with `connection refused`. Both systems are sles11. I found a description of the error on this page as follows. **Message** :   pdsh@local_hostname: target_hostname:connect: Connection refused **Cause** :   The target system is unreachable, or the r services may be disabled for this system. **To Correct** :   Check the r services and whether the target system is up and connected. In my case, the target system is up so the cause should be the disabled r services.   So what are `r services` and how could I enable it?


title: What is this new /run filesystem?

text: I just ran `df -h` a minute ago and noticed a filesystem has been added that I'm not familiar with. Does anyone know why `/run` exists? Is this something that's been added by the kernel? By Arch Linux?               run              10M  236K  9.8M   3% /run


title: Mounting a device — role of /dev, /media and /mnt, and the mount command

text: I have several closely related questions about what happens when I insert a CD. The files on the CD `/media/Ubuntu\ 11.04\ i386/`, but from what I've seen `/dev/cdrom` is also involved.   1. What is the difference between `/dev`, `/media` and `/mnt`? Following is what I have found from internet but I still have little idea: >     * `/dev` — this folder contains device files >     * `/media` — this is a mount point for removable devices >     * `/mnt` — this is a temporary mount point   2. What is the purpose of `mount`? In other words, if a device has been represented by the OS as a device file under `/dev`, why can it not be accessed via the device file directly without mounting?  Is mount only used for storage device, not for non-storage device, such as graphical card, network card, camera, ...?   3. Where is a device file under `/dev` mounted to, under `/media` or under `/mnt`? I remember I have seen both, but am curious when to mount to which?   4. I found my CD was automatically mounted to `/media/Ubuntu 11.04 i386`. I guess the device file of the CD is `/dev/cdrom`, but I cannot confirm it by looking into `/dev/cdrom` and `/media/Ubuntu 11.04 i386`:              $ ls -l /media/Ubuntu\ 11.04\ i386/     total 3522     -r--r--r-- 1 Tim Tim     143 2011-04-27 13:04 autorun.inf     ...     $ ls -l /dev/cdrw     lrwxrwxrwx 1 root root 3 2011-05-28 15:12 /dev/cdrw -> sr0     $ ls -l /dev/cdrom     lrwxrwxrwx 1 root root 3 2011-05-28 15:12 /dev/cdrom -> sr0      How can I find out which device file is for my CD?


title: Why is my tar file bigger than its contents?

text: I have a tar file that I have recreated from two files - xaa, xab (the results of using the split command). The tar file is the size I expect it to be but when I extract it the folder I get is a fraction of the size of the tar file. See the terminal output below for the sequence of my commands. Unfortunately I don't have the orignal tar file or folder - so this is my only chance to recover this data. When I open the archive in the 'File Roller' I see the same folders as I do on the command line after extraction and these are only a subset of the files I'd expect to see. Can anyone suggest why this might be?               ~> cat xa* > archive     ~> file archive     archive: POSIX tar archive (GNU)     ~> ls -la archive     -rw-r--r-- 1 hugo users 24471439360 Jun  1 18:50 archive     ~> tar xf archive     ~> cd repos     ~/repos> du --max-depth 0 -h     83M .     ~/repos> cd ../     ~> tar cf newarchive repos     ~> ls -la newarchive     -rw-r--r-- 1 hugo users 53288960 Jun  1 19:57 newarchive


title: Is there a Linux tool for defragging NTFS partitions?

text: Can NTFS partitions be defragged within Linux? Does fsck work for this? (Here and there I've seen a recommendation to use `fsck -t ntfs --kerneldefrag /dev/XXX`. Would this work?)


title: When will this cron run

text: Cron: `* */6 * * * /path/to/command` I want this cron to run once in every 6 hour. Whats wrong with the above cron definition, and why?


title: Why the -u flag doesn't work for ps?

text: I'm executing the following `ps` command:               root@dor-desktop:/home/dor# ps u -t "$(tty)" -u mysql     USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND     dor       2070  0.0  0.1  22436  5240 pts/0    Ss   20:29   0:00 bash     root      2411  0.0  0.0  56028  1916 pts/0    S    20:45   0:00 su     root      2419  0.0  0.0  19532  2276 pts/0    S    20:45   0:00 bash     root      2488  0.0  0.0   4108   668 pts/0    S    20:51   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --b     mysql     2607  0.0  0.4 146552 19024 pts/0    Sl   20:51   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --use     root      2672  0.0  0.0  15268  1224 pts/0    R+   20:59   0:00 ps u -t /dev/pts/0 -u mysql      You can see that the command asks for processes who are associated with the current terminal and who's user is `mysql`. But I get both types of processes! How can I separate? I want only the process who initiated by the user `mysql`. I found the following command: `ps -C mysqld`, which gives me want I need, but I prefer to understand what's wrong with the first command.


title: How to understand pipes

text: When I just used pipe in bash, I didn't think more about this. But when I read some C code example using system call pipe() together with fork(), I wonder how to understand pipes, including both anonymous pipes and named pipes. It is often heard that "everything in Linux/Unix is a file". I wonder if a pipe is actually a file so that one part it connects writes to the pipe file, and the other part reads from the pipe file? If yes, where is the pipe file for an anonymous pipe created? In /tmp, /dev, or ...? However, from examples of named pipes, I also learned that using pipes has space and time performance advantage over explicitly using temporary files, probably because there are no files involved in implementation of pipes. Also pipes seem not store data as files do. So I doubt a pipe is actually a file.


title: Execute a script automatically through pbrun?

text: There is a Unix environment named `sftwrk01`, `uatwrk01`, `intwrk01` and some more I need to check the logs in each environment everyday by login in as below (through pbsu which is a wrapper for pbrun):               $pbsu - sftwrk01  //this helps to login to sftwrk01      and then after login I check the logs. The same process goes for a few more environments like `uatwrk01`, `intwrk01` etc. Now I tried this:               $pbsu - sftwrk01 && cd var/can/log && ls -lrt      but this did not work because actually the statement `cd var/can/log && ls -lrt` was being executed after I exited from the sftwrk01 environment by typing `exit`. What could be the different possible solutions considering I don't have administrator rights? (i.e I am just one of the users in the home directory.) If this is not possible without administrator rights then you can mention a way you could do it with having full permission (perhaps you would edit the some `.profile` file to do that)               **OS Info :**     rcihp145 :/home/msingh2> uname -a     HP-UX rcihp145 B.11.23 U 9000/800 3683851961 unlimited-user license      Other info:                rcihp145 :/home/msingh2> ls -lrta      total 7296     -r--r--r--   1 msingh2    users          438 Dec 22  2010 .profile      drw-------   2 msingh2    users           96 Dec 22  2010 .ssh     -r--r--r--   1 msingh2    users          831 Dec 22  2010 .cshrc     -r--r--r--   1 msingh2    users          347 Dec 22  2010 .exrc     -r--r--r--   1 msingh2    users          333 Dec 22  2010 .login      -rw-------   1 msingh2    users           56 Dec 23  2010 .sh_history.     -rwxr-xr-x   1 msingh2    users         5451 Dec 23  2010 .dtprofile      -rw-------   1 msingh2    users      3577932 May 18 05:21 core     drwxr-xr-x  422 root       root         16384 Aug  3 14:27 ..     -rw-------   1 msingh2    users          245 Aug  4 00:41 .Xauthority     -rw-------   1 msingh2    users         1768 Aug  4 00:41 .TTauthority     drwxr-xr-x   4 msingh2    users         8192 Aug  4 00:41 .      -rw-------   1 msingh2    users        37533 Aug  4 00:41 .ICEauthority      -rw-------   1 msingh2    users         4064 Aug  4 06:28 .sh_history      drwxr-xr-x  12 msingh2    users         8192 Aug  4 06:28 .dt      -rw-------   1 msingh2    users         3462 Aug  5 02:29 .sh_history.msingh2      here is pbsu


title: Comprehensive /etc/auto.disks script for autofs that takes into consideration all mounted disks, including NTFS and FAT32?

text: Does anyone have a more comprehensive `/etc/auto.disks` script for `autofs` that takes into consideration all mounted disks, even NTFS, FAT32? So all that's needed to mount any attached drive is `ls /mnt/sda1` or `ls /mnt/sdb2`? This guide along the line of what I'm looking for, except this guy only accesses ext3 drives.


title: prevent filesystem access while passing information to and from programs

text: I have written a main script that calls a system program tens of thousands of times. The main script creates and provides this program with an input file on each call. Upon completion, the program creates an output file which is read by the main script. The program is run with: `program inputFile outputFile` The main script is running slowly, and I believe that this is due to the large I/0 overhead incurred whilst running `program`. Is it possible to run this program without writing or reading to disk? Note that both `inputFile` and `outputFile` may contain multiple lines. The internals of the program could be changed, but I would prefer to not do this. Unfortunately I couldn't find relevant advice elsewhere.


title: How can i view the contents of a tar.gz file (filenames + filesize)

text: I cannot use `tar -tz` as the solaris version I'm using does not accept the -z option. I tried something like `gunzip file.tar.gz | tar -tv` but that only gives: > tar: /dev/rmt/0: No such file or directory ...and unzips the tar.gz to .tar which is undesired. I only want to look inside them without modification.


title: Why the dot in find commands?

text: Typically, one sees `find` commands that look like this:               $ find . -name foo.txt      when the search is to begin from the current directory. I'm finding that on my machines (Ubuntu, Cygwin) I get the same results without the dot. Why is it typically included? Is it just a convention to be explicit, or was/is it required on certain systems?


title: How to make changes to /etc/profile take effect

text: I am trying to change `$GRAILS_HOME` from `/usr/grails-1.3.7` to `/usr/grails-2.0.0` If I just do `export GRAILS_HOME=/usr/grails-2.0.0` it doesn't persist when I log out and back in. I found a line in `/etc/profile` using `grep -R "GRAILS_HOME" /etc/` which reads like               GRAILS_HOME=/usr/grails-1.3.7     ...     export PATH ... GRAILS_HOME ...      So I changed that and logged out. The change does not seem to have taken effect, although my edits to the file remain. I cannot reboot the machine as it is serving stuff for my buddy and he is only giving me some space. But I do want the environment variable changed permanently and everywhere. What do I need to do?


title: Permissions issues with mounting remote server into a specific folder

text: I'm doing the following to mount a remote server to a specific path on my server:               sshfs user@remoteserver.com:/backup/folder/ /home/myuser/server-backups/      However when I mount the server the folder permissions change (they become 700), and when I test my rsnapshot.conf file I get the following error:               snapshot_root /home/myuser/server-backups/ - snapshot_root exists \              but is not readable      What am I doing wrong ? should I mount the remote server with another user ?


title: What happens if a cron script tries to copy a directory at the same time as another process is writing to it?

text: For example, if I have a java process that (once every 2 hours) takes a backup of a large file, like 500mb, and places it into folder A on HDD A, and I want to schedule a cron script to copy the entire folder A to HDD B once per day... what happens if the cron script happens to fire while the java process is in the middle of writing to folder A? Will it wait? Will it just ignore the file that isn't done being written yet?


title: What causes ln: //: Is a directory?

text: When linking a directory to root, I get this error:               $ ln -s ~/inbox/ /     $ ln: //: Is a directory      Bash autocompletes the directory path by adding a /. I've tried escaping without success.               $ ln -s ~/inbox /      works though. Why is this?


title: ALSA sampling rate

text: Couple of questions:   1. If you set the capture sampling rate in ALSA API to say 1000Hz, is the input really sampled at 1000Hz, or does the sound card always sample at its maximum capable sampling rate, removing unwanted samples and returning a PCM stream at the required sample rate?   2. Is there a variable bandwidth (with bandwidth determined by ALSA sample rate) anti-aliasing filter present on the sound card input, or should I put an anti-aliasing filter in the analog audio before providing it to sound card input?


title: Release a port owned by third party application?

text: I have been consulted about any way to release a port owned by a third party application that is listening to it. Say the application uses sockets and is listening for an specific port the root now want to claim back without closing the application. I've been unable to give an answer. Is there any way to close the handle to the port from the terminal or with an specific API (say the root can write and run C++) that can accomplish this?


title: Connect to byobu screen session and execute command?

text: In a script I am building I'm experimenting with how to automate as much as possible. One of the more interesting challenges is to connect to a byobu screen session and execute a command. So I started where I thought things would be: how many screen sessions there are (game has 4 windows in byobu and lordquackstar has 2 windows) So I started in the obvious place, looking on how many screen sessions there are (game has 3 windows in byobu and lordquackstar has 2. The users are in separate putty instances)               game@quackgame:~$ screen -ls     There is a screen on:             2019.byobu      (01/05/2011 05:10:04 PM)        (Attached)     1 Socket in /var/run/screen/S-game.      Only one there, so I checked for the system               lordquackstar@quackgame:/home/game$ sudo ls -lAR /var/run/screen/     /var/run/screen/:     total 0     drwx------ 2 game          users         100 2011-01-06 09:18 S-game     drwx------ 2 lordquackstar lordquackstar 100 2011-01-06 09:17 S-lordquackstar          /var/run/screen/S-game:     total 4     prwx------ 1 game users 0 2011-01-08 07:55 2019.byobu     -rw------- 1 game users 0 2011-01-06 09:18 byobu-exchange     -rw-r--r-- 1 game users 3 2011-01-08 07:32 byobu.updates-available          /var/run/screen/S-lordquackstar:     total 4     prwx------ 1 lordquackstar lordquackstar 0 2011-01-08 07:42 1169.byobu     -rw------- 1 lordquackstar lordquackstar 0 2011-01-06 09:17 byobu-exchange     -rw-r--r-- 1 lordquackstar lordquackstar 3 2011-01-08 07:35 byobu.updates-available      Still no multiple screens So for my question: How can I connect to a window in byobu from a script? * * * On a slightly related note, once I connect to it from a bash script, is there any way to send it a command then detatch?


title: Commands for Auditing Installed Software

text: Similar to the question here, http://serverfault.com/questions/387111/inventory-or-audit-installed-linux- software, I would like to obtain ideas about commands that should be ran across various Linux/Unix distributions to audit installed software. It should cover at a minimum the following use cases:   1. Software installed from packages   2. Software installed from source   3. Software that is installed to an unknown or unexpected location Additionally, it should work on CentOS/RedHat, SuSE, and Macintosh OS. Some of the ideas that I have thought about in relation to obtaining the software installed include the following; however, I am not sure how practical they might be.   * Listing the running processes and making inferences from the output   * Listing the listening or open ports and making inferences from the output   * Running various CLI commands and trying to make sense of the output   * Performing a dump or listing of the installed packages from the native package manager   * Perform a find command to look for particular files or file names, perhaps even config files to assume that certain software exists The ultimate goal is to have commands that can be used and store the resulting output to a file. I would use this to run against various machines, either locally on the machine or via SSH, for auditing, record keeping, and determining which hosts are vulnerable to particularly announced vulnerabilities.


title: How can I list all user names on Solaris 10?

text: I forgot a user that I created on solaris 10, so now **I would like to list all user names on my server**. Is it possible (I am root user)? What command I should use if possible? Somewhere on the net I read `getent` will list all usernames of a group. I have tried _**getent**_ without a group as I do not remember group also, but got error message (getent databse usage ..)


title: sybase and iconv

text: I inherited an old Ubuntu 6.10 server running php 5.1.6 which is using sybase to connect to MSSQL. A user submitted some text containing an en-dash and crashed one of my script. It turns out sybase doesn't like UTF-8 characters such as en-dash or é. Future searches in the database will also not like these characters. To remedy this, I want to convert characters such as en-dash to hyphen, é to e, etc... I did a little research into transliteration. The solution I came up with was to use PHP's iconv function to transliterate from UTF-8 to ASCII. It works fine on my development machine (Ubuntu 12.04) but not on my old production server (Ubuntu 6.10). After some debugging, I think I've tracked down my problem to the version of iconv.               echo café > test.txt     iconv --from-code=UTF8 --to-code=ASCII//TRANSLIT test.txt          result on 6.10: caf?     result on 12.04: cafe          iconv --version     result on 6.10: iconv (GNU libc) 2.4     result on 12.04: iconv (Ubuntu EGLIBC 2.15-0ubuntu10) 2.15      `locale` on both systems returns "en_US.UTF-8" I think I need to upgrade the production machine's iconv library but I'm not quite sure how to go about this.


title: how to setup AucTex with LuaTex in Emacs

text: How can I add to the list LuaTeX when I type `Ctrl``c` `Ctrl``c`? I was able to add Latexmk to the list by adding               (add-hook 'LaTeX-mode-hook (lambda ()       (push          '("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t           :help "Run Latexmk on file")         TeX-command-list)))      What would be the `/.emacs` entry for LuaTeX? Or is there a way to bind switching to the LuaTeX? For example, `Ctrl``l`.


title: CentOS, Django, mod_wsgi permission error

text: Running CentOS 6.4, Django 1.5.1, and mod_wsgi 3.2. I've set up a simple server configuration but when I restart the httpd service I get the following error in the logs: `(13)Permission denied: mod_wsgi (pid=4672): Couldn't bind unix domain socket '/etc/httpd/logs/wsgi.4715.0.1.sock'` I don't know if I need to update mod_wsgi (or even how to?) or what else to look for.


title: USB flash drive file transfers seem to hang multiple times during file transfer

text: I've got Scientific Linux 6.4 Installed (RHEL6.4) and am having trouble transferring to and from USB flash drives... Transfer seems to hang multiple times during transfer **to** the device, and transfer **from** the device is slower than it should be (500kb/s), I think this is due to multiple hangs during this transfer too. After quite a bit of googling I'm suspicious of this Memory Management Problem. I'm a bit dubious of the patch suggested as it may be worse than the original problem (see linked article in memory management problem). Also, It seems this problem has been solved in a later kernel as show here. My current kernel version is 2.6.32-358.23.2.el6.x86_64. I'm not sure whether I should manually upgrade the kernel, having never done this before and I guess that a lot of the dependencies would also need upgrading from source too. I didn't have this problem in version RHEL5 and rather than perform a fresh install, would like to fix this in 6.4. Let me know if you need more info.


title: nas4free server can't access local network

text: I'm not a linux/unix/freebsd expert. I'm a Microsoft .NET developer that knows Windows pretty well. Please bear with me :) I'm trying to configure an old desktop machine as a NAS device with nas4free. I followed the setup and user guide to install nas4free on the primary HDD, configure network, and configure IP address. I'm using DHCP to acquire an IP address, which works. It gets an IP of 192.168.1.107, which is an address in a valid range for my LAN. However, using the ping tool in the menu (and the ping command from the shell), pinging anything other than 192.168.1.107 times out (google.com, my gateway IP, other machines on the LAN by name and IP). Pinging the nas4free server from other machines on my network also time out. So the network stuff seems to work enough to get an IP address but nothing else ... how can I diagnose this issue?


title: Trying to remove all ids from an HTML file with grep

text: I'm trying to remove all `id=" "`s from an `.html` file but I'm not sure where I am going wrong. I tried using regular expressions but all I am getting is the `.html` file rendering in my Ubuntu terminal. Code:               grep -Ev '^$id\="[a-zA-Z][0-9]"' *.html      I am executing it with `bash ex.sh`.


title: Backing up chroots for host reinstall

text: I've had my workstation for a couple of years now and its slowly become a complex beast, taking on many roles for my dev and test work. I have done some research and was thinking of setting up some chroot environments to help keep things contained (web/app server, 32/64bit development env, etc...). I'd like to configure this and migrate from the current setup, so I can make sure it all works before committing to the move. I would then like to reinstall my host OS. (A more recent version of Ubuntu as I'm on an older LTS release. I could reinstall the same version if it complicates things, I just want a clean host, as things have become a mess over time) If I create the chroots on a mounted filesystem, can I reinstall the host OS, reconfigure chroot, mount the chroot directory and things work? Am I oversimplifying things? Any information or links are very much appreciated.


title: Can overwritten files be recovered?

text: I am not talking about recovering deleted files, but _overwritten_ files. Namely by the following methods:               # move     mv new_file old_file          # copy     cp new_file old_file          # edit     vi existing_file     > D     > i new_content     > :x      Is it possible to retrieve anything if any of the above three actions is performed assuming no special programs are installed on the linux machine?


title: How do I redirect command output to a file?

text: I have a command that I run in a folder that outputs MD5 hashes and filenames on the terminal:               ls |sort -nr | xargs md5sum      I need this output in a text file that I can download and compare to another folder on another customer's machine. How can I modify the command such that its output is stored in a file in say `/tmp`? I'm using Redhat 5.


title: How to sed -e 's///' everything except a specific pattern?

text: How can I substitute everything in a string with sed except % and any number directly succeding it? Meaning, everything except strings such as: `%1` `%1000` `%55` etc. Best * * * @devnull pointed out that the question isn’t very clear as sample input is missing. Given strings of this form:                   1: [18x14] [history 1/2000, 268 bytes] %3         2: [18x14] [history 1/2000, 268 bytes] %4 (active)      I only want to get the `%3` and `%4` parts. The numbers can go up to `999`. Sorry for the unclear question.


title: Difference between ssl/https and plain https in nmap output

text: I'm trying to analyze the behavior of an IP that works as free WiFi access point. nmap with parameter (-sV) reports the following for two different measurements: PORT STATE SERVICE VERSION 443/tcp open ssl/https? PORT STATE SERVICE VERSION 443/tcp open https? Why does one show up as ssl/https? while the other is just https??


title: what is meant by connecting STDOUT and STDIN?

text: This is a newbie question. I'm reading a book, it says: > Every process has at least three communication channels available to it: > “standard input” (STDIN), “standard output” (STDOUT), and “standard error” > (STDERR). > > Most commands accept their input from STDIN and write their output to > STDOUT. They write error messages to STDERR. This convention lets you string > commands together like building blocks to create composite pipelines. > > The shell interprets the symbols `<`, `>`, and `>>` as instructions to > reroute a command’s input or output to or from a file. > > To connect the STDOUT of one command to the STDIN of another, use the `|` > symbol, commonly known as a pipe. >   >   >     ps -ef | grep httpd >   So basically what this is saying is that standard input is a command that allows user to write to a file, while standard output is a command that has the bash shell write output to the shell, and standard error is just like output but it is only invoked when there is an error in file system. Then we get to the part of connecting STDOUT and STDIN and I'm lost.


title: Dual booting on a Macbook Pro 7,1.

text: I'm looking to install Linux on my Macbook Pro in a Dual Boot config. I've previously asked this question in a different fashion here: Dual Boot Fedora 16 with OS X rEFIt. However, it didn't really get much attention and seems to have fallen of the radar. I'd like to ask the question again, but in a different scope. I'd like to start learning how to operate Linux and I think the best way to get this going would be having it as a boot option on my Macbook, rather than running in a VM. I've tried Ubuntu, and it was pretty but I felt like I wanted something a little bit less hand holdy. The question I'd like to ask is such: What distro would you recommend as a good starting point that is both simple to use (not necessarily simple like Ubuntu), compatible (or can be made compatible) with rEFIt, and compatible with dual booting on a Macbook Pro 7,1 model?


title: How to get over "device or resource busy"?

text: I tried to rm -rf a folder, and got "device or resource busy". In Windows, I would have used LockHunter to resolve this. What's the linux equivalent? (Please give as answer a simple "unlock this" method, and not complete articles like this one. Although they're useful, I'm currently interested in just ASimpleMethodThatWorks™)


title: Getting config error for yum in CentOS

text: I'm very new to linux, and I am using CentOS in a VM for program testing. Everything seems to be fine, except for every few minutes I get this error: `Error Type: <class 'yum.Errors.ConfigError'>` `Error Value: File contains no section headers.` I looked in a few forums, and one said to use this command `cat /etc/yum.repos.d/fedora-updates.repo`, but when I did so it said there was `no such file or directory`. Any thoughts on how I can go about fixing this? I'm very much a beginner when it comes to linux, so step by step would be greatly appreciated.. EDIT: I used the CentOS-Base.repo command, here is the output               CentOS-Base.repo               enabled=1          [base]     name=CentOS-$releasever - Base     mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os     #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6          #released updates      [updates]     name=CentOS-$releasever - Updates     mirrorlist=http://mirrorlist.centos.org/?     release=$releasever&arch=$basearch&repo=updates     #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6          #additional packages that may be useful     [extras]     name=CentOS-$releasever - Extras     mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras     #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6          #additional packages that extend functionality of existing packages     [centosplus]     name=CentOS-$releasever - Plus         mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus     #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/     gpgcheck=1     enabled=0     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6          #contrib - packages by Centos Users     [contrib]     name=CentOS-$releasever - Contrib     mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib     #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/     gpgcheck=1     enabled=0     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


title: How to check if the remote rsyslog client is running

text: At the moment I'm implementing the part of the monitoring system that is build around the rsyslog and auditd. I would like to include into the project a _correct_ verification of the fact that **remote rsyslog client facility is running**. This check should be repeated on the rsyslog server at short time intervals. The simpliest way to do that is to trace the timestamps of the latest log file modifications. If the log file (which one is used by rsyslog server to redirect incoming messages) have not been modified recently, we can conclude that the remote rsyslog went down and sending no more messages. But I doubt the correctness of this method.


title: Porting jvm into the kernel space?

text: Currently I am playing with the idea of a jvm running in the kernel space, as a (maybe linux) kernel module. I see a lot of advantage of the idea. Of course the biggest advantage of a such system were the major simplification of the kernel space development. But it happened because different aspects: 1) every java developer with a relative minor lowlevel knowledge were able to develop a kernel module. Yes, it is't surelly a good possibility :-), especially if we see the current code quality of most opensource java userspace projects, but... there isn't a need to happen the same in the kernelspace as well. 2) (And it is the really intended goal): a JVM could solve the greatest problem of the kernel development, and it is the lack of the memory protection. A binary code segment compiled from java never caused any harm to data structures out of its scope, if there isn't another problem (f.e. jit compiler error or lowlevel hw problem), although the runtime safety checks of a such binary code caused a well measurable drawback in speed. First, it doesn't need to be a java bytecode interpreter as well. A JIT (just in time compiler) could exist on the system user space, mapping only the compiled binary files (practically: kernel modules) in the kernel space. Only the namespace manager and the garbage collector need to run in kernel space. Second, it doesn't need to be big, slow and monstrous. It is because the big, ineffectively used libraries in the case of the userspace jvms, and there is no ground for the same in case of, for example, _a driver written in java_. The only fallback which I can see were with the realtime functionality. Of course it were much harder to do with java, because we have much fewer control on the minor details of the memory management. What about I am curious, if a such project already exists (?#1), and are there any visible major fallbacks about this if not (?#2).


title: Multibooting FreeBSD and other Linux distros

text: Long story short: Have one laptop, need to multiboot FreeBSD/OpenBSD as well as a number of Linux distros. Which one do you think should go first? FreeBSD offers a bootMgr, but I'm not sure how it relates with GRUB. How am I supposed to make the partitions knowing that a harddisk can take up to four primary partitions, perhaps make one primary, one extended and make logical partitions? If so, how to do that with `fdisk` because the options aren't very clear about that.


title: Is an LXC guest load average the same as the host's load average?

text: If I run `top` on the guest, the load average values seem to be exactly the same as running `top` on the host. Is a Docker (LXC) guest's load average the same as the host's load average?


title: Filtering on dates with grep and awk

text: I have created the alias below in my `.bash_aliases` file               alias auth="grep \"$(date|awk '{print $2,$3}')\" /var/log/auth.log |                 grep -E '(BREAK-IN|Invalid user|Failed|refused|su|Illegal)'"      This is supposed to:   * check todays date   * grep `auth.log` for todays messages   * grep todays messages for warning messages matching particular strings However, it only works when there's a 2-digit day because days numbered <10 do not have a preceding zero. For example, I run `date` and pipe the result to `awk`. `date` outputs `Sat Jan 1 04:56:10 GMT 2011` and then awk captures `$2` and `$3` and feeds them into grep as follows               Jan 1      However, when there's a single digit day, messages in `auth.log` appear as follows               Jan  1 00:44:57 linux su[21249]: pam_unix(su:session): session closed for user root      So there are two spaces following `Jan` in the `auth.log` but only one space following `Jan` in my grep command How can I modify the command to allow for the additional space?


title: How to build a cross-distro binary RPM package?

text: I'm trying to build a cross-distro binary RPM package that works under Fedora and openSUSE. I'm using a `Require:` tag to set the dependencies package names. The problem is that the package names are different in each GNU/Linux distro repo. Reading: http://goo.gl/3MXSq, and using '%if 0%{?suse_version} ' statements give a cross-distro .spec file. That is, the list of deps will be determined at build-time not install-time. Is there a way to set a conditional list of deps inside a binary RPM package?


title: Where should I copy-paste-install software to?

text: I'm installing IntelliJ, and the readme tells me to choose an installation folder. Where is a good, standard place to put installed programs?


title: Is it safe to rm -rf /tmp/*?

text: This is something I used to do a lot on Windows, but after my recent fiasco I want to make sure. Is it safe to do               sudo rm -rf /tmp/*      ?


title: I can't kill xfwm4

text: $ ps aux | grep xfwm     xralf  4365  1.2  0.4  19888  9444 ?        S    10:45   0:00 xfwm4 --replace --display :0.0 --sm-client-id 204399537-7a38-4196-8c31-43cf2f3542ac     xralf  4369  0.0  0.0   3324   788 pts/0    S+   10:45   0:00 grep --color=auto xfwm      after `$ kill -9 4365`               $ ps aux | grep xfwm     xralf  4379  0.4  0.4  20632  9976 ?        S    10:47   0:00 xfwm4 --replace --display :0.0 --sm-client-id 204399537-7a38-4196-8c31-43cf2f3542ac     xralf  4381  0.0  0.0   3324   788 pts/0    S+   10:47   0:00 grep --color=auto xfwm      Is it possible to kill `xfwm4`?


title: How to run the file-copy dialog of thunar, or anything similar to use?

text: I'm trying to create a Send To menu for thunar, which copies a file (%F) to a fixed location. In KDE4 I could use `kioclient copy` command, but what about other environment? Does thunar has something similar or is there any other file copy dialog I can use?


title: Installation script needs to be run as a certain (regular) user but needs to create a system directory

text: I'm new to Linux, let me explain the issue. I'm trying to install `comsol` with some sort of network license. If I use `sudo ./setup` the server directory does not recognize the username "root". The server recognizes my username which is zahir. If I just write `./setup` the installation passes the license check stage but can't proceed since it cannot create directory in `/usr/local`. What command should I use so that the installation runs as `zahir` but with root privileges?


title: Capturing key input from events device and mapping it (toggle TouchPad key is unmapped)

text: I have a Lenovo IdeaPad Yoga 13 with Ubuntu 13.10 Installed. The device has a "Toggle TouchPad" button on the keyboard (`F5`). The keyboard's `F*` buttons are reversed (so to get `F5`, I need to press `Fn` \+ `F5`, and `F5` is actually the toggle key). I've found out that the button is actually read by the keyboard (rather than the TouchPad like certain devices), which is at `/dev/input/event3`. So using `sudo input-events 3` I was able to figure out that the button sends the scan code 190: Output of `sudo lsinput`:               /dev/input/event3        bustype : BUS_I8042        vendor  : 0x1        product : 0x1        version : 43907        name    : "AT Translated Set 2 keyboard"        phys    : "isa0060/serio0/input0"        bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP      Output of `sudo input-events 3`:               23:13:03.849392: EV_MSC MSC_SCAN 190     23:13:03.849392: EV_SYN code=0 value=0     23:13:03.855413: EV_MSC MSC_SCAN 190     23:13:03.855413: EV_SYN code=0 value=0      No other programs (such as `xev`) seem to be able to read it except for `input-events`. Is there any way to map this button to make it toggle the TouchPad on my laptop? If so, how can I do so?


title: Viewing virtual memory usage

text: I started 700+ threads from a single program And my `/proc/[PID]/status` file shows the following output.               VmPeak:  7228104 kB     VmSize:  7228104 kB     VmLck:         0 kB     VmHWM:      3456 kB     VmRSS:      3456 kB     VmData:  7222340 kB     VmStk:        88 kB     VmExe:         4 kB     VmLib:      1540 kB     VmPTE:      2864 kB     StaBrk: 15e84000 kB     Brk:    15ec6000 kB     StaStk: 7fff765095a0 kB     Threads:        706      But I'm having only 2gb RAM and 4gb swap space. Can somebody tell me how did the Virtual Memory get to 7gb+?


title: How to define a minor mode that uses specified input-method in Emacs

text: I want to use korean characters in Emacs, so I installed hangul.el. I can activate input-method by '(set-input-method "korean-hangul")'. And I want to define a mode that have the `korean-hangul' input method. I only know how to define a minor mode with a defined map-key like this. `(easy-mmode-define-minor-mode korean-mode "Mode for korean" nil " 한" korean- mode-map)` But I don't know how to connect a input-method and a minor-mode. I'll add add some key-bindings to the `korean-mode`. How can I define a mode like this `korean-mode`?


title: The curous incident of the missing ppa.ko in debian 3.11 kernel?

text: Ok. Running a version of LDME with a kernel of 3.11-2-amd64 ( basically debian testing). Suddenly with the installation of this particular kernel the module ppa.ko is gone. Further an `apt-file search` shows that this module does not exist. Anyone know what is happening?


title: What's the right way to set Linux kernel runtime parameters?

text: What's the prescribed way to set Linux kernel runtime parameters? I've seen sometimes that people will set these in files such as `/etc/rc.local`. Is this really the right way to do this?


title: Could not resolve host error

text: I'm using Arch Linux and I have a dynamic ip address with the use of dhcpcd. I can access websites through the google chrome but the problem is that I get 'could not resolve host' error when I run some commands on the terminal (like git clone). I've tried pinging github.com and doing nslookup and it returns the correct ip. Any ideas?


title: How to terminate a background process in Linux when the pid is unknown?

text: I have a job dispatcher bash shell script containing below codes:               for (( i=0; i<$toBeDoneNum; i=i+1 ))     do         while true         do                 processNum=`ps aux | grep Checking | wc -l`                 if [ $processNum -lt $maxProcessNum ]; then                     break                 fi                 echo "Too many processes: Max process is $maxProcessNum."                 sleep $sleepSec         done         java -classpath ".:./conf:./lib/*" odx.comm.cwv.main.Checking $i     done      I run the script like this to be in the background:               ./dispatcher.sh &      I want to terminate this dispatcher process with kill -9. But I didn't record the pid of the dispatcher process at the first time. I used jobs, jobs -l, jobs -r and jobs -s. Nothing showed. Even this fg cannot bring the process to foreground.               fg     bash: fg: current: no such job      But I think this dispatcher process is still running because it still continues to assign java program to run (already used top and ps -ef to check). How should I terminate this job dispatcher bash shell script process?


title: two if conditions in for loop bash scripting

text: I've trying to make two if conditions in for loop. Is it possible this? Now doesn't return anything from second `if` only two `OK` from first `if`.               #!/bin/bash     servers=("212.39.82.157" "212.39.82.157" "1.1.1.1")          for i in "${servers[@]}"; do          ping -c 1 $i > /dev/null        if [ $? -eq 0 ]; then          echo "OK"         fi            if [ $(netstat -na | grep ':3708' | grep ESTABLISH | wc -l) -eq 2 ]; then          echo "NOT - OK"       fi     done      For third `IP`in the list must return `NOT - OK` since is not online. But the output is this               root@ubuntu:~$ ./check.sh     OK     OK     root@ubuntu:~$      What I missing here? UPDATE:                #!/bin/bash     servers=("212.39.82.157" "212.39.82.157" "1.1.1.1")          for i in "${servers[@]}"; do          ping -c 1 $i > /dev/null        if [ $? -eq 0 ]; then          echo "OK"         fi     done       if [ $(netstat -na | grep ':3708' | grep ESTABLISH | wc -l) -eq 0 ]; then          echo "NOT - OK"       fi      If I put it outside for loop it must work?


title: home-built router - slow throughput

text: I am having slow performance with my home-built router. Compared to a stock Verizon (actiontec) router, it gets about 60 Mpbs down and 30 Mpbs up whereas I get about 15 Mbps and 20 Mbps up. I switched out my home-built router (an old laptop computer) for a desktop and the performance dropped to 2 Mbps down and 10 Mpbs up all the time whereas the laptop seemed to be consistently faster with the occasional slow-down. Now, I am doing traffic shaping; however, that shouldn't be the dominant problem. With the laptop, I still randomly did get 2 Mbps down randomly so I'm not sure if it is hardware or software (configuration). They share the same hardware (when testing, I used a USB ethernet adapter since both devices come with 1 onboard NIC). It _could_ be a faulty NIC (the USB ethernet adapter), but it could more likely be configuration. When capturing traffic with wireshark/tshark, I see a bunch of duplicate ACKs and TCP retransmissions. That could indicate bad wiring, but if I'm using that same cable for outbound traffic, that likely is not the issue. I also later measured bandwidth on the cable and found it to be 97.2 Mbps (one NIC is only 10/100). It could be a faulty NIC (the USB ethernet adapter), but why would I still get more performance on the laptop with it?


title: Consistent (physical) volume on set of files (volume normalization)

text: If I have, say, 20 music videos (`.flv` and `.mp4`), is there a way to play them in mplayer (mplayer2) without having to change the volume for each video, instead specifying a desired general volume, and having mplayer adjusting automatically whenever necessary? **Edit** : Possibly this is called "volume normalization". By the way, I'll accept any solution for this, or even a description what is required. I use mplayer at the moment, but, if you solve this with, say, a microphone, a script, and vlc, that will be great. **Edit 2** : This is close to, but not quite "volume normalization": check out my comment to David Kohen's answer below.


title: SSH asks password when outside .ssh/ but not when inside .ssh/

text: This is the strangest I've ever encountered and I have no idea how to fix it. I have many entries in my `.ssh/config` file because I use a number of keys. When I `ssh` and I am located outside my `.ssh` folder I get prompted for a password (key was passwordless). When I `cd` to my `.ssh` folder, same command `ssh {alias}` connects directly as expected (doesn't ask for password). Do you have ANY idea why this could be happening?


title: How can I work around the program failing if there is *any* stdin?

text: For example, the following works fine:               /usr/bin/program      It produces some output, and gets to result. But if I invoke it like this:               echo -n | /usr/bin/program      or this               echo -n | bash -c "/usr/bin/program"      or even this:               echo -n | bash -c "wc -c; /usr/bin/program"      It produces some lines of output, then fails. I have no access to source of the program, so I can't even look what could cause this behavior. And when I try to invoke it from the python script, I get the same stuff:               echo | python -c 'from subprocess import call; call("/usr/bin/program", shell=True)'      (version without "echo" prepended works fine) I don't even have the faintest idea why that could be happening. Stdin is going to be open even if I don't explicitly specify where the program should read from, so that shouldn't be the cause. Is there any way to work around this issue? **EDIT:** The last four lines from `strace` output - the only ones that differ:               # without echo     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     ...          # with echo     select(1, [0], NULL, NULL, {0, 0})      = 1 (in [0], left {0, 0})     write(4, "\0\0\0j\0\0\0\3\0\0\0\4\0\0\0\0\377\377\377\377", 20) = 20     write(3, "\0\0\0j\0\0\0\3\0\0\0\4\0\0\0\0\377\377\377\377", 20) = 20     exit_group(1)                           = ?      **PARTIAL SOLUTION:**               sleep 20 | /usr/bin/program      Seems that `program` waits for something to happen at stdin, and exits if it encounters a newline or EOF (we can see it from `select` call in strace output - it timeouts if input comes from "real" user). So we needed a program that doesn't write anything to stdin, while still keeping it open - `sleep` does the job.


title: gnuplot shell variable substitution and arrays

text: I need to use shell variables in my gnuplot commands, for which I'm using the here document style. I also need to use loops inside the gnuplot code. Both these things are working. Now -- I want to use a gnuplot for loop's index to access a shell array variable. This is where I've been stuck all day. I have something like this:               for ((i=0; i<=10; i++))     do     var[$i] = i*10     done          gnuplot<<EOF     do for [j=1:10]{     #need to access ${var[j]} somehow     val=sprintf("${var[%d]", j) ##doesn't work     }     EOF      Individual access like ${var[1]} works. I suspect this may need using backquotes and/or expr, but am not sure.


title: adb connection problem on Kubuntu 13.04 x64

text: I'm facing a problem with ABD connection under Kubuntu 13.04 x64. Every time I try to push/pull/shell ls the adb disconnects from device. I tried the following solutions:   1. Added device ID into .android/adb_usb.ini but nothing helped   2. Added new udev rule and also nothing helped   3. Flashed the ROM and nothing helped   4. I re-installed my Kubuntu 13.04 x64 Some notes :   * USB Debugging activated   * Device is Prestigio PMP5080BRU (Rooted) - Android Gingerbread 2.3.1   * I'm using the latest Android SDK available on official web site   * The ADB works very well on Windows 7 x64   * Even when ADB disconnects, I still can see device via **lsusb** command   * ia32-libs already installed on the system   * jdk and jre installed on the system and works as expected   * Paths configured and working properly   * ADB works as expected with my Samsung Galaxy S II (Jelly Bean 4.1.2 - Stock)   * I put my question here, because it seems I got a problem in Linux, as my other device works on Kubuntu dmesg :               [ 5571.640498] usb 3-2: new high-speed USB device number 13 using xhci_hcd     [ 5571.657013] usb 3-2: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64     [ 5571.657426] usb 3-2: New USB device found, idVendor=0bb4, idProduct=0c02     [ 5571.657433] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3     [ 5571.657436] usb 3-2: Product: rk2918     [ 5571.657439] usb 3-2: Manufacturer: RockChip     [ 5571.657442] usb 3-2: SerialNumber: 0123456789ABCDEF     [ 5571.664067] scsi13 : usb-storage 3-2:1.0     [ 5572.659163] scsi 13:0:0:0: Direct-Access     PMP5080B                  0100 PQ: 0 ANSI: 2     [ 5572.659453] scsi 13:0:0:1: Direct-Access     PMP5080B                  0100 PQ: 0 ANSI: 2     [ 5572.661211] sd 13:0:0:0: Attached scsi generic sg2 type 0     [ 5572.661525] sd 13:0:0:1: Attached scsi generic sg3 type 0     [ 5572.662492] sd 13:0:0:0: [sdb] Attached SCSI removable disk     [ 5572.662947] sd 13:0:0:1: [sdc] Attached SCSI removable disk      Any one got an idea? Regards,,,


title: bash script selecting the last path variable

text: Hey all i am writing my first bash script. and i am making it install all the repos i have on github.               warpInLocations=("git@github.com:acc/toolkit.git" "git@github.com:acc/sms.git" "git@github.com:acc/boogle.git" "git@github.com:acc/cairo.git")      so those are them so when i install them               echo "warping in toolkit, sms, boogle and cairo"     for repo in "${warpInLocations[@]}"     do       warpInDir=$(echo ${warpToLocation}${repo} | cut -d'.' -f1)       if [ -d "$warpToLocation"]; then         echo "somethings in the way.. $warpInDir all ready exists"       else         git clone $repo $warpInDir       fi          done      this line here i wanted it to give me a folder named toolkit or sms so after the / and before the . in the warp in locations but its selecting git@github instead i guess because its after the . how can i get it to select the name in the repo??


title: 64bit rpm can not resolve 32bit dependencies

text: **Problem** I'm having a RPM that contains mixed 64bit and 32bit binaries. One of the binaries depends on 32bit i686 packages. When I try to install the package yum gives me an error, noting that the package requires the 32bit packages. However when I just try to install the required packages myself it works flawless. **Details** In my spec file I have               Requires:       glibc.i686 libstdc++.i686 device-mapper-libs.i686 lshw      When I try to install the package on a CentOS 6.3 system I get:               # yum update gamigo-kvm-tools     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package gamigo-kvm-tools.x86_64 0:0.0.7-4 will be updated     ---> Package gamigo-kvm-tools.x86_64 0:0.0.9-4 will be an update     --> Processing Dependency: libstdc++.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Processing Dependency: glibc.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Processing Dependency: device-mapper-libs.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Finished Dependency Resolution     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: libstdc++.i686     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: device-mapper-libs.i686     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: glibc.i686      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      However when I manually install the referenced packages, I get               # yum install libstdc++.i686 device-mapper-libs.i686 glibc.i686     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Install Process     Package libstdc++-4.4.6-4.el6.i686 already installed and latest version     Package device-mapper-libs-1.02.74-10.el6.i686 already installed and latest version     Package glibc-2.12-1.80.el6_3.5.i686 already installed and latest version     Nothing to do      I don't quite understand why the Error occurs and what it's trying to tell me. I see that it's only occurring for the 32bit packages as the fourth required package 'lshw' seems to be no problem. Is there a special specfile syntax to reference 32bit packages?


title: Can I assert that a Wi-Fi AP with a higher "quality" will be better in most cases?

text: I have an application on Raspberry Pi that needs to determine which available Wi-Fi access point to use, with their statistics collected by `iwlib` beforehand. `iwlib` or `iwlist` has three indicies for each Wi-Fi access point: "quality", "signal level", and "noise level". By saying a Wi-Fi access point is "good", I am talking about a high success rate in transmission. My question is: Is it safe to assume that one access point with a higher "quality" is mostly likely to be better than one with a lower "quality" value?


title: Ending Process Infinite Loop Input Redirection

text: Edit: I realized that the program I was trying to run had an infinite loop after scanning all my input. Then just prints out infinitely so it'll never read the EOF. It'll read the last input then go into an infinite loop For example let's say the program is something like this.               printf("%c\n", getch());     while(1)     {        printf("%c\n", getch());     }      Is there a way to kill the program after reading in all my input? I want to be able to kill the program when it finishes redirecting the input file. (When the program gets the last character from the input file) Note: I cannot modify the program I'm running but I can modify the script that runs this program. Right now I have this in my script to run the program. Basically this helps me combine/merge input + output together. EDIT: Someone helped me with solving my earlier problem. I was suppose to add || break to this strace but I have a new problem which is in the edit at the top.               mkfifo strace.fifo     {       while read -d, trace; do         if [[ $trace = *"read(0" ]]; then            IFS= read -rn1 answer <&3 || break            echo "$answer" >> in            answer=${answer:-$'\n'}            printf %s "$answer" >&2            printf %s "$answer"         fi       done < strace.fifo 3< input | strace -o strace.fifo -e read stdbuf -o0 ./a.out &     } >> $fname.out 2>&1      So right now I have a really hacky way of trying to end the program by using sleep and killing the program. Also I'm checking the input used so far and comparing it with the input file. This is just a small example of what I'm doing my current script has multiple timer and if comparisons similar to the code below. However this way is not a good way because if the program isn't done reading the input file after whatever second I put it won't kill the program. In my real script I used multiple of these if statements and it works like 80% of the time but sometimes it won't do the right thing probably because of the timer and the fluctuation of the way the program runs.               sleep .05     awk 'BEGIN{ORS="";} NR==1{print; next;} /^[^ ]/ { print; next; } {print "\n";}' in > temp     diff -w -B temp input > /dev/null     # Check if input done yet     if [ $? -eq 0 ] ; then        # Check if program still running and input done        if [ "$(pidof a.out)" ] ; then           killall -15 a.out > /dev/null 2>&1        fi     fi      So I'm wondering is there a way to `kill` the process in the `strace` after input is done? Also I want to be able to keep input and output merged together.


title: How to copy multi-page text from the terminal into the clipboard?

text: I was viewing a **man** page for a software on my machine and I needed to copy-paste some of that text but the text was much more than one page. I'm aware I can direct the output to a file and use UI based software such as **gedit** to copy the text I need. But can this be done from the terminal ? **Joseph** suggested a command line method (Little bit complicated to me, I'm not yet good with regular expressions on Linux). But I'm wondering if there is a way to do so while I'm still on the terminal, **using the mouse**. I hope I get a generic answer, however, I'm using Ubuntu.


title: Reading from a serial interface

text: I have a serial device running which I need to read data from(I have absolutely no control over the device itself) except reading its output; using hyper terminal in Windows I am able to detect a meaningful traffic and yesterday when I used cat (or my own little C program to read the data and print it to stdout) it worked fine. Today, when I use cat/my program all I get is a sort-of corrupted data, yet hyper terminal still shows the data. What could possibly be wrong? how could it have worked yesterday but not today? The file I am/was reading is `/dev/ttyUSB1` *Please note that I am never running BOTH my program and cat, only one of them at a time.