How do I fix these broken dependencies?

aptitude tells me I have some packages with broken dependencies:               kmiller@debian-dev-box:~$ sudo aptitude search '.*' | grep ^.B     iB  console-setup-linux             - Linux specific part of console-setup           iB  gir1.2-freedesktop              - Introspection data for some FreeDesktop co     iB  gir1.2-glib-2.0                 - Introspection data for GLib, GObject, Gio      iB  gir1.2-gstreamer-0.10           - Description: GObject introspection data fo     iB  gir1.2-json-1.0                 - GLib JSON manipulation library (introspect     iBA libatk-adaptor                  - AT-SPI 2 toolkit bridge                        iB  libgcc1                         - GCC support library                            iBA libgfortran3                    - Runtime library for GNU Fortran applicatio     iBA libgomp1                        - GCC OpenMP (GOMP) support library              iB  libstdc++6                      - GNU Standard C++ Library v3                     But the 'broken'-ness can't be too bad because:               kmiller@debian-dev-box:~$ sudo apt-get -f install     Reading package lists... Done     Building dependency tree            Reading state information... Done     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.          kmiller@debian-dev-box:~$ sudo apt-get -u dist-upgrade     Reading package lists... Done     Building dependency tree            Reading state information... Done     Calculating upgrade... Done     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      It's most worrying that libgcc1 has broken dependencies. What do I do to find out what to fix?!               kmiller@debian-dev-box:~$ sudo aptitude install -f     ...     0 packages upgraded, 11 newly installed, 177 to remove and 0 not upgraded.     ...     The following packages have unmet dependencies:      libstdc++6 : Breaks: gcc-4.3 (< 4.3.6-1) but 4.3.5-4 is to be installed.      gir1.2-json-1.0 : Conflicts: gir1.0-json-glib-1.0 but 0.10.2-2squeeze1 is to be installed.      gir1.2-gstreamer-0.10 : Conflicts: gir1.0-gstreamer-0.10 but 0.10.30-1 is to be installed.      libgfortran3 : Breaks: gcc-4.3 (< 4.3.6-1) but 4.3.5-4 is to be installed.      libgomp1 : Breaks: gcc-4.3 (< 4.3.6-1) but 4.3.5-4 is to be installed.      libgcc1 : Breaks: gcc-4.3 (< 4.3.6-1) but 4.3.5-4 is to be installed.      gir1.2-freedesktop : Conflicts: gir1.0-freedesktop but 0.6.14-1+b1 is to be installed.      gir1.2-glib-2.0 : Conflicts: gir1.0-glib-2.0 but 0.6.14-1+b1 is to be installed.      libatk-adaptor : Conflicts: at-spi but 1.32.0-2 is to be installed.      console-setup-linux : Breaks: console-terminus but 4.30-2 is to be installed.


Gaussian, which is run with nohup on remote linux machine, gets killed when the local computer is powered down before the shell is exited

I have a problem running Gaussian on remote Linux via SecureCRT on Windows. ## Gaussian Gaussian spawns different child executables ("link"s) when running. For example, I start Gaussian by running `nohup g09 < test.in > test.out 2> test.out &`, and `g09` will spawns different `link`s such as `l301.exe` and `l502.exe` at specific circumstances. ## Run Gaussian When I connect to the remote Linux box, and run Gaussian using `nohup ${Path_Of_Gaussian}/g09 < jobname.in > jobname.out 2> jobname.out &`:   1. If I exit the shell by typing `exit` and press `Enter`, I can exit while Gaussian on Linux keeps running (name of the specific executable depends on specific timing).   2. If I power down the computer (then the SecureCRT will be shutdown), Gaussian on Linux gets killed and complains "hang up".   3. If I exit by typing `exit` and press `Enter`, and then log on, I can power down the computer and Gaussian on Linux keeps running.   4. `jlliagre`'s answer does not work in this case. ## Run simple command Taken a simple executable, which does nothing (i.e., deals nothing with input & output) but sleeps for 10 minutes, for example. When I run it by `nohup ${Path_Of_Executable}/executable &`:   1. If I exit the shell by typing `exit` and press `Enter`, I can exit and the executable keeps running on Linux.   2. If I power down the computer (then the SecureCRT will be shutdown), the executable running on Linux gets killed.   3. If I exit by typing `exit` and press `Enter`, and then log on, I can power down the computer (then the SecureCRT will be shutdown) and the executable on Linux keeps running.   4. As in `jlliagre`'s knowledgeable answer, if I run `nohup ${Path_Of_Executable}/executable </dev/null >/dev/null 2>&1 &`, I can power down while the executable on Linux keeps running. In other words, why would Gaussian, which is run on a remote machine with `nohup`, get killed when the local computer is powered down before the shell is exited?


Is there a way to set network proxy system-wide?

If I want to have GNOME applications (as well as Firefox and Chrome) access the network through a proxy, I need only use **`gnome-network-properties`** (a nice and simple GUI I must say). For other apps (e.g. APT, Transmission, XChat), I have to use their specific ways of doing it. Is there a way to avoid this, something I can turn on and off when in a network that requires a proxy (hostname:port)?


iptables: redirect local request with NAT

I'd like to redirect local requests to port which is translated with NAT. I have following rules:               iptables -t nat -A PREROUTING -p tcp --dport 9020 -j DNAT --to 10.0.3.11:80      however request coming from localhost are rejected:               wget http://127.0.0.1:9020     Connecting to 127.0.0.1:9020... failed: Connection refused.      When I'm connecting from any other computer it works. Is there a way how to do this without recompiling kernel with `CONFIG_IP_NF_NAT_LOCAL=y`? https://wiki.debian.org/Firewalls-local-port-redirection (which seems to be obsolete). Update: `iptables -L -v -n --line-numbers -t nat`:               Chain PREROUTING (policy ACCEPT 26 packets, 3230 bytes)     num   pkts bytes target     prot opt in     out     source            destination         4       0   0     DNAT      tcp  --  *       *      0.0.0.0/0         0.0.0.0/0   tcp dpt:9020 to:10.0.3.11:80          Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)     num   pkts bytes target     prot opt in     out     source                destination              1        0     0 MASQUERADE all  --  *       *      10.0.0.0/16           0.0.0.0/0


How to find out which package of libc6 I need?

I am running into following error:               version GLIBC_2.14 not found      version GLIBC_2.15 not found      when trying to install software I need. Therefore, I decided to upgrade libc6 on my debian `(Linux nn15.project.org 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux)`. I found the libc6 package in this page and I guess I probably need unstable version. My questions are following:   1. How do I install specific version? So far I only used `apt-get install package`,    2. without specifying which one.which version should I use?   3. What's the difference between libc6-amd64, libc6-dbg, libc6-dev and others? I am using: Distributor ID: Debian Description: Debian GNU/Linux 7.1 (wheezy) Release: 7.1 Codename: wheezy


Is it a good idea to supplement shell script with perl purely for use of regex?

I'm looking for a simple way to utilize regex in a UNIX shell script where not every system will have perl extensions built into grep. What is really helpful about perl regex here is back/forward references which I haven't found a way to use effectively in sed. I've quickly come up with the following 1 liner: `tail --bytes=+K something.log| perl -e 'while (my $line = <STDIN>){if ($line =~ /$ARGV[0]/){print $line};}' 'my regex'` Q1. Is this a safe way to do things for perl? Q2. Should I just resort to writing the entire script in perl instead?


execute command from txt file

I have file and in this file i have this lines:               ssh root@server1.com     ssh root@server2.com     etc....      And i have script that i like to go on every server and execute the ls command on each of this servers that are on that file. What i did for now is:               while read line;     do     $line     done < $1      and it work but for the first line, after that it return an > Pseudo-terminal will not be allocated because stdin is not a terminal. > error. So i know I'm missing something but I'm a little lost here.


Linux Wordpress can't write wp-config file

I installed the latest version of Apache2 / PHP / MYSQL on my pc In the directory `/src/www/htdocs` I created a directory wordpress with all wordpress files. Then, when I tried to create the `wp-config` file through the web interface I get this error:               Sorry, but I can't write the wp-config file.      I tried this command to change the group of `/src/www/htdocs/wordpress`               chown -R root:root /srv/www/htdocs/wordpress      But it was not working. After some research, I have seen lot of people saying change the group to `www-data` but I do not see `www-data` using this command:               cut -d: -f1 /etc/group      Anyone know what I am doing wrong?


Bandwidth usage monitoring

> **Possible Duplicate:**   >  Find out network traffic per IP I want to monitor my bandwidth usuage for wired as well wireless devices on my network. Is there any tool, preferably one that does not use a master or agent concept or requires `snmp` on every device I want to monitor? I was searching and found `ntop` but it is not good enough as it has many limitations.


/var on an Logical Volume on ISCSI

I have Physical Volume that is on an open-iscsi device. This device is mounted after Linux has already started writing to the log files. Can I mount a Logical Volume on that Physical Volume to `/var` to have Linux write to there without losing anything? The reason for this is that I want to 'spare' my SSD from too much writing and not eating up all my memory (8GB). The mounting is not my problem since I already have some other Logical Volumes mounted after booting (I want to use one of them for storing my postgresql databases). Does anybody have some experience on this subject? It is hard to find information since `/var` is almost always present.


How can I do NFSv4 UID mapping across systems with UID mismatches?

I am working in a lab with three Ubuntu systems, and I would like to cross- mount some filesystems via NFS. However, while the systems have some of the same usernames, the UIDs and GIDs don't match, because the three systems were set up separately. When I mount an NFS filesystem from one system to another, the ownership shows up wrong. For example, if UID 1000 is alice on server1 and the same UID, 1000, is bob on server2, then when server1 mounts server2's exported filesystem, bob's files appear to be owned by alice. So Is there any way to make NFS (v4) convert UID's between servers via their associated user names? Googling for this, I've seen lots of references to Kerberos, LDAP, or NIS, which seems like massive overkill for such a simple task, and might not be possible since these systems are not centrally-managed. This link seems to indicate that what I ask is impossible. Is it correct? Edit: I've tried every configuration for `/etc/idmapd.conf` that I can think of or find on the internet, and while the idmapd process is clearly running, so far I have not seen any evidence that NFS is making any attempt to use it at all, and it has never had any effect whatsoever on the user ID's reported on NFS mounts.


Send attachment to gmail id from shell script

I have a shell script that generates reports. Using crontab i run the scrip everyday at 1000 hrs. I want to mail that report to my gmail id as an attachment. I have tried using mutt but it doesnt work for me. Please could you guide me through it. After installing sendEmail, when i am attempting to send the mail i am getting the following information               Sep 14 15:15:37 debal sendEmail[3671]: DEBUG => Connecting to smtp.gmail.com:587     Sep 14 15:15:38 debal sendEmail[3671]: DEBUG => My IP address is: 192.168.2.103     Sep 14 15:15:38 debal sendEmail[3671]: SUCCESS => Received:     220 mx.google.com ESMTP uw6sm17314211pbc.8 - gsmtp     Sep 14 15:15:38 debal sendEmail[3671]: INFO => Sending:     EHLO debal     Sep 14 15:15:38 debal sendEmail[3671]: SUCCESS => Received:     250-mx.google.com at your service, [180.151.208.181], 250-SIZE 35882577, 250-8BITMIME, 250-STARTTLS, 250-ENHANCEDSTATUSCODES, 250 CHUNKING     Sep 14 15:15:38 debal sendEmail[3671]: INFO => Sending:     STARTTLS     Sep 14 15:15:38 debal sendEmail[3671]: SUCCESS => Received:     220 2.0.0 Ready to start TLS     *******************************************************************      Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client      is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER      together with SSL_ca_file|SSL_ca_path for verification.      If you really don't want to verify the certificate and keep the      connection open to Man-In-The-Middle attacks please set      SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.     *******************************************************************       at /usr/local/bin/sendEmail line 1906.     invalid SSL_version specified at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 414.      I did a yum install on perl-Net-SSLeay perl-Net-SMTP-SSL and this is the result.               [root@debal ~]# yum install perl-Net-SSLeay perl-Net-SMTP-SSL     Loaded plugins: langpacks, refresh-packagekit     Package perl-Net-SSLeay-1.54-1.fc19.x86_64 already installed and latest version     Package perl-Net-SMTP-SSL-1.01-13.fc19.noarch already installed and latest version     Nothing to do      The problem still persists and I am using Fedora 19


os-prober not detecting Arch install

I'm triple booting osx, win 7 and arch on an apple macbook pro 8,2 I've followed the guide specific for my macbook pro here: Macbook Pro 8,2 Arch Installation As well as the beginners install guide here: Arch Beginners Guide Everything has gone well and I can boot and login fine. However I've come to a problem whilst trying to configure grub2. I've run this and I've verified that its worked correctly               # modprobe dm-mod      # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --boot-directory=/boot/efi/EFI --recheck --debug     # mkdir -p /boot/efi/EFI/grub/locale     # cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/efi/EFI/grub/locale/en.mo      However when I run,               # grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg      Whilst the config generator is running it spits out text from os-prober. It lists my osx and Windows partition but nothing about Arch. The config file generated doesn't contain any information about Arch either and when I try boot into grub2, it lists 2 Mac OSX partitions, 32 and 64 bit (of which only 1 exists) and neither boot as well as a Windows 7 partition which doesn't boot either. I think a big part of the problem is that os-prober isn't detecting the installations correctly. Does anyone have any idea why this would be? Thanks, Alex


named does't start when using systemctl

I am having trouble getting named to start using systemd on the Fedora 18 Raspberry Pi spin. It starts, then a few moments later there is a timeout and it fails. If I run the commands in named.service by hand, named starts just fine. I don't know what the timeout is that systemctl is looking for or where it is being invoked. I have read the man pages for systemctl, systemd and others and I will continue to research this, but if anyone has any pointers, that would be great. Thanks. systemctl status named.service output:               named.service - Berkeley Internet Name Domain (DNS)               Loaded: loaded (/usr/lib/systemd/system/named.service; disabled)               Active: failed (Result: timeout) since Tue 2013-01-29 14:36:41 EST; 35min ago              Process: 4189 ExecStart=/usr/sbin/named -u named $OPTIONS (code=exited, status=0/SUCCESS)              Process: 4186 ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf (code=exited, status=0/SUCCESS)              Process: 4183 ExecStartPre=/usr/libexec/generate-rndc-key.sh (code=exited, status=0/SUCCESS)          Jan 29 14:35:12 raspi.example.com named[4191]: all zones loaded     Jan 29 14:35:12 raspi.example.com systemd[1]: PID file /run/named/named.pid not readable (yet?) after start.     Jan 29 14:35:12 raspi.example.com named[4191]: running     Jan 29 14:36:41 raspi.example.com systemd[1]: named.service operation timed out. Terminating.     Jan 29 14:36:41 raspi.example.com named[4191]: shutting down     Jan 29 14:36:41 raspi.example.com named[4191]: stopping command channel on 127.0.0.1#953     Jan 29 14:36:41 raspi.example.com named[4191]: no longer listening on 127.0.0.1#53     Jan 29 14:36:41 raspi.example.com named[4191]: exiting     Jan 29 14:36:41 raspi.example.com systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).     Jan 29 14:36:41 raspi.example.com systemd[1]: Unit named.service entered failed state        The named.service file               [Unit]     Description=Berkeley Internet Name Domain (DNS)     Wants=nss-lookup.target     Before=nss-lookup.target     After=network.target          [Service]     Type=forking     EnvironmentFile=-/etc/sysconfig/named     Environment=KRB5_KTNAME=/etc/named.keytab     PIDFile=/run/named/named.pid     ExecStartPre=/usr/libexec/generate-rndc-key.sh     ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf     ExecStart=/usr/sbin/named -u named $OPTIONS     ExecReload=/bin/sh -c '/usr/sbin/rndc reload > /dev/null 2>&1 || /bin/kill -HUP $MAINPID'     ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID'     PrivateTmp=true     [Install]     WantedBy=multi-user.target


How to scp folders with nasty names using a shell function

I am trying to write a function that I will put on all my machines in order to make it easy to send files at a fixed place on my network. Here is my script so far. Some folder may have duplicates names on my machines, so I'm adding a uuid at the end of the folder name.               function putOnSG3() {     uuid=`uuidgen`     if [[ -d $1 ]]; then scp -rv "$1" shiny:/Volumes/Seagate3To/"$1.$uuid";     else echo $1 " is not a directory. Not copying.";     fi;     }      I'm invoking it like this:               $ putOnSG testFo\[l\}der      Here is the problem:               zsh:1: bad pattern: /Volumes/Seagate3To/testFo[l}der.d84abc26-501b-4f89-a636-518b4059a770      How can I manage these nasty filenames ? Target filesystem is case sensitive hfsplus, source filesystems are various extfs from Linux machines and NTFS.


Is there a way to make feh fade in between transitions?

I would like my desktop wallpaper to fade between transitions instead of a cut. Is there a way to do this with feh? Maybe using xcompmgr or compton? If not is there a way of doing it without changing to a different wm? I am using awesome at the moment.


How to run bash on CYGWIN

I have created following file with name test.sh               #!/bin/bash          name = "Elvin John Paul"     echo $name     echo ${name#* }     echo ${name##* }     echo ${name% *}     echo ${name%% *}      and I am getting some error as below. ![enter image description here](http://i.stack.imgur.com/JOehe.jpg) can anyone tell me what wrong I am doing?


VSFTP local user works, but PAM users Permission Denied

I am attempting to configure vsftp to use PAM to authenticate virtual users on my Arch server. It seems so straight forward, I must be missing something simple. ### Configuration   * local user virtualftp in group virtualftp   * folders /srv/ftp and /srv/ftp/test1 owned by virtualftp:virtualftp   * PAM user test1 password test1p in /etc/vsftpd_login.db /etc/pam.d/vsftpd               auth required pam_userdb.so db=/etc/vsftpd_login crypt=hash     account required pam_userdb.so db=/etc/vsftpd_login crypt=hash     session required pam_loginuid.so      /etc/vsftp.conf               anonymous_enable=NO     local_enable=YES     write_enable=YES     local_umask=022     dirmessage_enable=YES     xferlog_enable=YES     connect_from_port_20=YES     ftpd_banner=Welcome to MCID's FTP server.     chroot_local_user=YES     chroot_list_enable=YES     chroot_list_file=/etc/vsftpd.chroot_list     listen=YES     # nopriv_user=virtualftp          # SSL Configuration     # ssl_enable=YES     # allow_anon_ssl=NO     # force_local_data_ssl=NO     # force_local_logins_ssl=YES     # ssl_tlsv1=YES     # ssl_sslv2=YES     # ssl_sslv3=YES     # rsa_cert_file=/etc/ssl/certs/vsftpd.pem     # rsa_private_key_file=/etc/ssl/certs/vsftpd.pem          # Passive Port Range     pasv_min_port=49152     pasv_max_port=65534          # Added settings for PAM virtualftp logins     pam_service_name=vsftpd     guest_enable=YES     guest_username=virtualftp     virtual_use_local_privs=YES          # Private folders for virtual users     local_root=/srv/ftp/$USER     user_sub_token=$USER      Currently I can login with `sftp://theherk@sftp.example.com`, my local user just fine. However, if I attempt to login with test1, I get permission denied. What am I missing or confused about?


how to type linear algebra symbols

How do I type the symbols for linear algebra on Ubuntu? Are there any programs that use them? ( I understand this is trivial basket weaving. Whats the fastest way! )


Automatically apply module patch and compile kernel when updated?

I've recently applied a one-line patch to `drivers/bluetooth/btusb.c` in order to enable compatibility with my Bluetooth device. However, whenever I get a kernel upgrade, the patch will be lost until someone backports it (which isn't likely). Is there a way for me to run a script and patch each new kernel upgrade automatically? DKMS seems like a good solution, but I'm not sure how to set things up. I don't want to recompile the entire Linux kernel every time I get an update, but I'd like to apply that patch to the btusb module, recompile it, and insert it into my kernel on every update. How can I do this using the source obtained from `apt-get source linux-source-3.2.0`? What files do I need to copy over? The critical `make` call is `make M=drivers/bluetooth modules`, but this depends on other kernel utilities to be built first. How can I assemble a DKMS module for this? Details on how to apply the patch can be found here on Ask Ubuntu.


Who is setting http_proxy?

On an Ubuntu system with bash as the default shell for the interested user, the `http_proxy` environment variable is set to a specific value in a fresh GNOME Terminal. The `.bashrc` file for this user and the one common to all users are not setting this value. A recursive grep looking for the proxy specific value from the root file system is running, but will take hours to complete. What are the common places I can look at to know where this proxy value is set ?


Why does rm *(1)* remove all files in a directory?

I expected that:               $ rm *(1)*      would remove all files containing `(1)` in the name. I was wrong. It removed all files in the directory. Why?


How do I grep without leading whitespaces?

I'm greping through a large codebase, and leading whitespaces and tabulation seem to be quite annoying. Is there any way to get rid of it?               grep -R "something" ./      E.g, instead of:               foo/bar.cpp:                       qwertyuiosomethingoi     foo/bar/baz.h:                          43rfsgsomethingdrfg     bar/bar.cpp:            1234edwssomethingczd      I want to get something like:               foo/bar.cpp: qwertyuiosomethingoi     foo/bar/baz.h: 43rfsgdsomethingrfg     bar/bar.cpp: 1234edwssomethingczd      Or better:               foo/bar.cpp:   qwertyuisomethingooi     foo/bar/baz.h: 43rfsgdrsomethingfg     bar/bar.cpp:   1234edwssomethingczd


iptables: how to redirect outgoing, public ip traffic to localhost:6666, not touching private ips

I want all outgoing to traffic that is directed to a private IP (10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255, 192.168.0.0 - 192.168.255.255) to be untouched. I want all other traffic redirected to localhost:6666 (where I am running a socks5 proxy). I'm not sure what I need to do to not touch the private IP traffic but for the public traffic do I:               sudo iptables -t nat -A PREROUTING -p tcp -i <interface> -j REDIRECT --to-ports 6666      am I on the right track? UPDATE: This did the trick:               echo "Flushing previous rules..."     iptables -t nat --flush          echo "Deleting and recreating the PUBPROXY chain..."     iptables -t nat -X PUBPROXY     iptables -t nat -N PUBPROXY          echo "Setting iptables to ignore traffic directed to private ips..."     iptables -t nat -A PUBPROXY -o lo -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 10.0.0.0-10.255.255.255 -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 172.16.0.0-172.31.255.255 -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 192.168.0.0-192.168.255.255 -j RETURN           echo "Redirecting other traffic to socks5 proxy running at localhost:6666"     iptables -t nat -A PUBPROXY -p tcp -j REDIRECT --to-port 6666


How to use 32 bit compiled shared object (.so) file on 64 bit RHEL?

I have a shared object file libfault.so for my 32 bit compiled application on RHEL 6.4. I want to preload this file while starting my application. I have placed it in /usr/local/lib/ directory. But while starting the application, i am getting the following error.               ERROR: ld.so: object 'libfault.so' from LD_PRELOAD cannot be preloaded: ignored.      But, if i compile libfault.so in 64 bit and place in /usr/local/lib64/, I do not get the error. But the file is not doing its intended function since my application is 32 bit compiled.


LVS is not accessible from the outside

I'm currently busy setting up a LVS - Linux Virtual Server:               root@debian1:~# ipvsadm -L     IP Virtual Server version 1.2.1 (size=4096)     Prot LocalAddress:Port Scheduler Flags       -> RemoteAddress:Port           Forward Weight ActiveConn InActConn     TCP  debian1.lan:http wlc       -> debian2.lan:http             Masq    1      0          1                -> debian3.lan:http             Masq    1      0          1               debian1.lan is my VIP. debian2 and 3 are running apache. I'm able to use `curl` to get content:               root@debian1:~# curl debian1.lan
debian2

This is the default web page for this server.

The web server software is running but no content has been added, yet.
           But when I access debian1.lan (10.0.0.171) using `firefox` from my windows computer I get a "The connection has timed out" message. Is it maybe possible that Virtualbox is messing up the LVS? (debian 1 to 3 are VM's in Virtualbox using a bridged adapter). I started `tcpdump` on my debian2 and I see packets (when I use `firefox`) although I'm not sure about the meaning:               root@debian2:~# tcpdump -s 0 -A tcp port http     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes     13:07:05.725727 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0     E..4.M@....-     ...     ......Pg......... .\...............     13:07:05.725755 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:06.722025 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:08.722729 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:08.723841 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0     E..4.a@.....     ...     ......Pg......... .\...............     13:07:08.723849 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:12.722808 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:14.724158 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,nop,sackOK], length 0     E..0.g@.....     ...     ......Pg.......p. .p...........     13:07:14.724179 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:20.722805 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............      Can somebody offer me a helping hint on what I may do or check next?


What standard shell command can evaluate escaped Unicode in a stream?

I'm looking for a pipeable command that will convert substrings in the form of ‘`\unnnn`’ to the actual characters. For example:               $ echo 'co\u00ebfficient' | what_command     coëfficient


Home folder with Windows + Mint dual boot

I am dual-booting Linux Mint 17 Cinnamon 64-bit and Windows 8.1 64-bit. Since I use both OSes to work with the same files, I am thinking what would be the best approach to read and write files using both OSes. I am considering to create a separate partition for such files. Since Linux can access and write files located in a Windows partition but the opposite is not true, then a NTFS partition should work well for the common files. But my question is: how do I "link" the folders on this new partition to Linux /home? In Windows, there is the concept of libraries, and it is possible to add any folder in your system to the useful "My Music", "My Videos", etc. in "My documents". Would it be possible to do something similar with Linux? Or do I really have to mount this partition every time I boot my system and manually navigate to its subfolders? Or yet, is there any better approach to deal with common files than what I am proposing?


Alternative for jq in debian wheezy to parse json in bash

In Ubuntu you can simply install jq               apt-get install jq       but on debian it is not in the repository. Is there an alternative commandline to parse a JSON string on the console? maybe you can achieve this with python like (fantasycode):               cat test.json | python 'parse_json(stdin)'


Concatenation of two fields of two files

I have two files : called `t1.txt` and `t2.txt`. The contents are : ### t1.txt               a     b     c      ### t2.txt               ab     bc     cd      Now I want to merge these two files line by line into t3.txt so that the t3.txt should look like : ### t3.txt               aab     bbc     ccd      Please help in getting the output using shell script.


LinuxMint doesn't recognize `Katakana/Hiragana` key in japanese keyboard

I installed `LinuxMint 16 Cinnamon` in a virtualbox environment. And set `Keyboard Layouts` `Japanese` in `Regional Settings`. But `Katakana/Hiragana` key that is obviously implemented in Japanese keyboard, is not recognized. There is no response if I hit the key on `xev` window. As far as I checked other keys are recognized properly. What should I do to enable the `Katakana/Hiragana` key?


Where can I find the list of [[ ]] options?

like               [[ -s file ]]     [[ -z string ]]      preferably on the web. I looked on the ldp site but couldn't find them The man page (`man [`) is helpful but I am looking for a more compact list.


Installing CoGrOO on Kile

Does anyone know if it is possible to install/include CoGrOO on Kile? CoGroo: http://cogroo.sourceforge.net/


Setup LDAP client on RHEL 6.5

I am preparing for RHCSA exams and trying to setup LDAP client on my RHEL 6.5 box I am connecting to the online testing LDAP server Here I don't understand the relationship among following 3 files, not sure if they all needed or not.               /etc/openldap/ldap.conf     /etc/pam_ldap.conf     /etc/nslcd.conf      Basically I just put same settings in all the files, with correct syntax. For example here is my /etc/nslcd.conf               uid nslcd     gid ldap     uri ldap://ldap.forumsys.com/     base dc=example,dc=com     binddn cn=read-only-admin,dc=example,dc=com     bindpw password     ssl no      I verified that there is connection from my local host to ldap.forumsys.com port 389 and when I tried `id euler` I see traffice between my pc and LDAP server but it just could not resolve user name from LDAP server. Again I am not even sure this is the correct way of verifying it. Any advice ?


can I make awk cut its input according to '\n'?

we all know that we can get the columns of a line using awk, but the columns is split by white spaces:               cat FileName | awk ' { print $1,$2,$3 .... }'      but what if we want to split the files according to '\n':   for example if we have this file:               Hi      Hello     Aloha      and we want to get the second word 'Hello' using 'awk' what should we do?


Fast and slow symlinks

From http://en.wikipedia.org/wiki/Symbolic_link#Storage_of_symbolic_links > Early implementations of symbolic links stored the symbolic link information > as data in regular files. The file contained the textual reference to the > link’s target, and an indicator[clarification needed] denoting it as a > symbolic link. > > This method was slow and an inefficient use of disk-space on small systems. > An improvement, called **fast symlinks** , **allowed storage of the target > path within the data structures used for storing file information on disk > (inodes)**. This space normally stores a list of disk block addresses > allocated to a file. Thus, symlinks with short target paths are accessed > quickly. Systems with fast symlinks often fall back to using the original > method **if the target path exceeds the available inode space**. The > original style is retroactively termed a **slow symlink**. It is also used > for disk compatibility with other or older versions of operating systems.   1. Does "allowed storage of the target path within the data structures used for storing file information on disk (inodes)" mean that a fast symlink stores the path of the linked file inside the inode of the fast symlink Does a fast symlink, as a file itself, actually only have an inode and has no file content? Does a slow symlink, as a file itself, have an inode and some file content which is the target path?   2. What does "if the target path exceeds the available inode space" mean? Is it correct that if a symlink to a file is a fast symlink, if and only if the symlink and the file are on the same file system?   3. Is there any command that can check if a symlink is a fast or slow one?    4. When a symlink has file content, what is the command to show the content of the symlink? (So that if a fast symlink doesn't have file content and a slow one has, we can verfiy that.)


How do you adjust other user's job priority?

Let's say your coworker started a very intense process and went home. It's occupying most of the CPU resources, and you can't do your stuffs because of it. If it was your own process, you could run 'renice' on it. If you don't have a root privilege, what are some things you can do to run your heavy processes alongside the coworker's process?


What are the exact differences between awk and cut with grep?

We know that we can get the second column of the line we want from a file using these two techniques:               awk '/WORD/ { print $2 }' filename      or               grep WORD filename| cut -f 2 -d ' '      My questions are:   * What are the differences between the two commands above?   * Which one has the best performance?   * What are the advantages of using `awk` over using `cut`, and vice versa?   * What options does `awk` give us over `cut` and vice versa?


File descriptor and fork

When a child is forked then it inherits parent's file descriptors, if child closes the file descriptor what will happen ? If child starts writing what shall happen to the file at the parent's end ? Who manages these inconsistencies , kernel or user ? when a process calls the `close` function to close a particular open file through file descriptor. In the file table of the process, the reference count is decremented by one. But since parent and child are both holding the same file, the reference count is 2 and after close it reduces to 1. Since it is not zero the process still continue to use file without any problem. See Terrence Chan UNIX system programming,(Unix kernel support for Files).


Does the suid bit have any meaning for device files?

Does the suid bit have any special meaning for device files in Linux ?


using gmake and make

My Makefile entry has this snippet:               ####### Compiler, tools and options          CC              =       cl     CXX             =       cl     LEX             = flex     YACC            = byacc     CFLAGS  =       -nologo -Zm200 /MD /NODEFAULTLIB:msvcrtd /map:"Debug/eta.map" -W3 -MD -Od  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG     CXXFLAGS        =       -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG     LEXFLAGS        =     YACCFLAGS       =-d     INCPATH =        -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"$(QTDIR)\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc"     LINK    =       link     LFLAGS  =       /NOLOGO delayimp.lib /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /NODEFAULTLIB:"libc" /SUBSYSTEM:windows /incremental:no /LIBPATH:"$(QTDIR)\lib"     LIBS    =        "qt-mt338.lib" "qt-mt338.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib"     MOC             =       $(QTDIR)\bin\moc.exe     UIC             =       $(QTDIR)\bin\uic.exe     QMAKE           =       qmake     IDC             =       $(QTDIR)\bin\idc.exe     IDL             =       midl     ZIP             =       zip -r -9     COPY_FILE       =       copy     COPY_DIR        =       copy     DEL_FILE        =       del     DEL_DIR =       rmdir     MOVE            =       move     CHK_DIR_EXISTS =        if not exist     MKDIR           =       mkdir     INSTALL_FILE= $(COPY_FILE)     INSTALL_DIR = $(COPY_DIR)          ####### Files       Intentionally left out to reduce size          ####### Implicit rules          .SUFFIXES: .c .cpp .cc .cxx .C          {.}.cpp{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.cc{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.cxx{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.C{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.c{}.obj::             $(CC) -c $(CFLAGS) $(INCPATH) -Fo @<<             $<             <<     ####### Build rules          all: Makefile             $(TARGET) $(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)              $(LINK) $(LFLAGS) /OUT:$(TARGET) @<<             $(OBJECTS) $(OBJMOC) $(LIBS)             <<               mocables: $(SRCMOC)     uicables: $(UICIMPLS) $(UICDECLS)          Makefile:             eta.pro  C:\Qt\3.3.8\mkspecs\win32-msvc\qmake.conf $(QMAKE) -o Makefile eta.pro     qmake:              @$(QMAKE) -o Makefile eta.pro             More rules ...      I get this error: (Why?)               Linux:~/edge/src/qt/utilities/app/eta> gmake     cl -c -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"/home/sam/edge/qt4\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc" -Fo @<<     /bin/sh: -c: line 0: syntax error near unexpected token `newline'     /bin/sh: -c: line 0: `cl -c -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"/home/sam/edge/qt4\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc" -Fo @<<'     gmake: *** [{.}.cpp{}.obj] Error 1


Running MATLAB on Linux with SGID

I want to run my matlab instance as a special group. I tried setting sgid on matlab-startup-script or (not exclusive) on MATLAB-binary. Both ways were not successful.   For example running `sudo chmod g+s matlab glnxa64/MATLAB` and `matlab` results in               /usr/local/MATLAB/R2013a/bin/glnxa64/MATLAB: error while loading shared libraries: libut.so: cannot open shared object file: No such file or directory      The given file has read and execute rights for root, group (same as sgid) and even world. Isn't that strange?


Override LDAP login shell for a specific user in RHEL

How in RHEL do I specify /sbin/nologin shell to limit a user to SFTP access only when their shell is determined by their LDAP profile? chsh only works with passwd file users I believe.


How to use -d in ntfsundelete?

As far as I can tell from the manpage of `ntfsundelete` getting a file back is done with e.g.               ntfsundelete /dev/sdb3 -u -m important.txt      which would undelete the file in-place. If I don't want in-place mode I see this option               -d, --destination DIR  Destination directory      but when I use it `-d /tmp/win` it thinks it is a regex. How should `-d` be used?


How to tell if mysterious programs in nethogs listing are malware?

This is what I see in Nethogs: ![Screenshot](http://i.stack.imgur.com/2or3H.png) I'm concerned about the listings with PID `?`, running as `root`. How can I find out what these are? I'm running Linux Mint 14. Please let me know what other information I should include.


Configuring Org-mode to open PDFs with evince

I'm starting to use `org-mode` to export text to LaTeX. My problem is that it opens the generated PDF with `ebook-viewer` (it is a EPUB, CHM reader) instead of using evince. _Question_ Does anyone know how to change this behaviour and configure `evince` to be the default viewer?


execute bash script inside .bashrc

Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell. Here is an example bash_script.sh:               #!/bin/bash     echo Hello World      .bashrc               export HELLO_WORLD=$(bash_script.sh)


Reference request: Porting linux on any ARM based board

I am looking for a book or any other source that helps me in understanding detailed procedure for porting Linux on ARM based boards from scratch. There are many articles on internet but I could not find a single complete reference describing the procedure from scratch.


How to get notified when svcadm restarts a service that died

I'm using svcadm to keep my node.js server running on Illumos, is there a way to get notified if svcadm restarts the server because it crashed? Specifically if the process went down on its own and not when I restart it. I'd like a script to run so I can send an email or raise an alert.


Increment xml files with bash

A good mate on a forum had helped me with creating this script but everything Ive thrown at it outputs wrong and I do not know why or what is the issue. I ran all my script in ubuntu's terminal if questioned as bash test.sh. My goal is to increment several .xml file's `process></process>` tags, but some files could have 1 to 100 tags. **Example:**                - jfksaJDFH      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - jdhkjasdh      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      **After script:**                - jfksaJDFH      - <process>value="1"</process>      - <process>value="2"</process>      - <process>value="3"</process>      - <process>value="4"</process>      - jdhkjasdh      - <process>value="5"</process>      - <process>value="6"</process>      - <process>value="7"</process>      - <process>value="8"</process>      **Script:**               #!/bin/bash          dir="/mnt/Desktop/test/"          while IFS= read -r -d '' file     do         i=1         while IFS= read -r -u 3 line         do             if [[ $line = '<process></process>' ]]; then                echo "<process>value=\"$((i++))\"</process>"             else                echo "$line"             fi         done 3< "$file" > "$file.xml"     done < <(find $dir -type f -name \*.xml -print0)      when script above is ran removes last `<process>value=""</process>` **modify script to this:**               while IFS= read -r -d '' file     do         i=1         while IFS= read -r -u 3 line         do             if [[ $line = '<process></process>' ]]; then                echo "$line"             else                echo "<process>value=\"$((i++))\"</process>"             fi         done 3< "$file" > "$file.xml"     done < <(find $dir -type f -name \*.xml -print0)      **Output of file is this:**               <process>value="1"</process>     <process>value="2"</process>     <process>value="3"</process>     <process>value="4"</process>     <process>value="5"</process>     <process>value="6"</process>     <process>value="7"</process>     <process>value="8"</process>     <process>value="9"</process>     <process>value="10"</process>     <process>value="11"</process>     <process>value="12"</process>     <process>value="13"</process>     <process>value="14"</process>     <process>value="15"</process>     <process>value="16"</process>     <process>value="17"</process>     <process>value="18"</process>     <process>value="19"</process>     <process>value="20"</process>     <process>value="21"</process>     <process>value="22"</process>     <process>value="23"</process>      which in other words increments but removes all other content in the page.


Regex for phrase matching with case statement in ksh

I am trying to start or stop a service on AIX in ksh. I am trying to start to build in fool proofing for checking things like if the services is already down, etc. Here is my script               #!/bin/ksh               #################################################################################     #                        PARAMETERS & VARIABLES SECTION                         #     #################################################################################          DBI_LOC="DBI/InstallCollector/dbi_collector/bin"          #Put input option to upper case.     OPTION=$( echo "$1" | tr "[:lower:]" "[:upper:]" )          #################################################################################     #                              FUNCTION SECTION                                 #     #################################################################################          parseresults() {         typeset RESULT="$1"              if [ "${OPTION}" = "START" ] ; then             case "${RESULT}" in                  *)                     echo "Success"                 ;;             esac         else             case "${RESULT}" in                  DBI.(Collector is not running))                     echo "Collector is already down. Continuing..."                 ;;                 DBI.(performance data collector shutdown COMPLETE))                     echo "Success shutting down collector. Continuing..."                 ;;                 *)                     echo "Error shutting down the collector. Exiting with error."                     exit 1                 ;;             esac         fi     }               #################################################################################     #                             MAIN SCRIPT SECTION                               #     #################################################################################                    case "${OPTION}" in         "START")             echo "Starting the collectors..."             RESULT=$(ksh ~/${DBI_LOC}/start_dbi_collector.sh)             ;;         "STOP")             echo "Stopping the collectors..."             RESULT=$(ksh ~/${DBI_LOC}/stop_dbi_collector.sh)             ;;         *)             echo "Error: No Parameter specified. Must be either start or stop"             exit 1             ;;     esac          echo ${RESULT}     parseresults ${RESULT}          echo     echo      I can't seem to get it to match on the two DBI phrases. Both of those are possible outputs from their stop script. I want to consider those successes, but anything else a possible failure. I'm still learning regex (and its differences in Java vs ksh, etc.) so you'll have to excuse my rustiness. What am doing wrong? And in your answer could you please explain why mine doesn't work and the right answer does. (I'm a proponent of the whole if you teach someone to fish thing....) **EDIT:** I'm thinking it has something to so with the parenthesis. I have another script which had the same problem of hanging, but when I removed the parens, the function quite hanging. So my trick is still how to do matching on phrases....


bash while loop that breaks at a given file size

So, I bought this book called _Primes and Programming_ , and it's pretty tough going. Today I wrote this (simple) program from chapter 1:               #!/usr/bin/env python          import math          def find_gcd(a,b):         while b > 0:             r = a - b * math.floor(a/b)             a = b             b = r         return int(a)          if __name__ == "__main__":         import random, sys         while True:             print find_gcd(random.randrange(int(sys.argv[1])), random.randrange(int(sys.argv[2])))      ...and just now I called it like so:               ./gcd-rand.py 10000 10000 > concievablyreallyhugefile      ...and now I'm dreaming of a `bash` one-liner that breaks when concievablyreallyhugefile has reached a certain size. I guess it would look something like:               while $(du -h f) < 32M; do ./gcd-rand.py 10000 10000 > $f; done      ...but I have never written a while loop in `bash` before and I don't really know how the syntax works.


What is the difference between the output of TOP command and Oprofile?

In the `top` command one of the processes is always showing a CPU usage of 4 to 5%. But in `oprofile` the CPU usage is 0.004%. I do not understand this. And I also noticed that even when a process is in sleep state, the process has got some CPU usage. How is it possible?


Generic HTTP server that just dumps POST requests?

I am looking for a command line tool that listens on a given part, happily excepts every HTTP POST request and dumps it. I want to use it for testing purposes, i.e. for testing clients that issue HTTP POST requests. That means I am searching the counterpart to `curl -F` (which I can use to send test HTTP POSTs to a HTTP server). Perhaps something like `socat TCP4-LISTEN:80,fork,bind=127.0.0.1 ...` - but socat is not enough because it does not talk HTTP.


Hiding User from Last Command

Is there any way to hide a particular user's login entry from other users who run the `last` command?


Illegal float value "error" c-shell

I have a form made it with a couple of text boxes, in which I input floating numbers and use this number to sum with other text box and put the result in a label. I then input the values of the text boxes to a variable (xbiz and xbder) and I sum it for example I get then this result : xbiz = 5.2 xbder = 2.3 **My problem is when one of the text boxes is empty** (in blank) the script give me an error of "ILLEGAL FLOAT VALUE!" I mean if I am not input a value in any od the two variables How can solve this problem? Here is my code:               #FORM     echo "FG 999999" >> $gui_in     echo "FONT cbr18" >> $gui_in     echo "BG 901010" >> $gui_in     echo "LABEL LOCATINES" >> $gui_in     echo "FG 101090" >> $gui_in     echo "FONT cbr18" >> $gui_in     echo "BG 708787" >> $gui_in          echo "TEXT xbiz X_BOT_IZQ" >> $gui_in     echo "TEXT xbder X_BOT_DER" >> $gui_in          #Calculation     set varx = `echo " $xbder + $xbiz" | bc -l`               #After calculate the values of the two variables (xbder + xbiz) I use the result in the following line:          COM display_layer,name=comp,display=yes,number=1     COM add_pad,attributes=no,**x=${varx},y=${varx}**,symbol=${sizefido},polarity=positive,\     angle=0,mirror=no,nx=1,ny=1,dx=0,dy=0,xscale=1,yscale=1


how to tell if a partition is empty/unused

This is certainly a really easy question for you all I am sure. So I have Ubuntu (13.04) as the only OS mounted on my HDD. What I would like to do is re-partition my HDD so as to begin a LFS build.   Using `sudo fdisk /dev/sda`, and `p` for print partition table I get:               /dev/sda1 * ................................. 83 linux     /dev/sda2   ................................. 5 extended     /dev/sda5   ................................. 82 linux swap/solaris      I would like to use the swap space that is `/dev/sda5` as the swap space for the build so as to not have superfluous swap space. Also, I would like to build the system in an extended system so I can make logical partitions for `/boot`, `/`, `/usr`, et al. My question is, how do I figure out what is in the `/dev/sda2` partition? Is it empty? Is it available for me to build my LFS base in? If it is empty, then I won't partition anything. If it is being used by Ubuntu for something then I will have to build another primary partition for the build. Unfortunately I do not remember making the partition, if I did.


Install Chromium OS without USB Disk

You seem to need a 4GB USB disk or flash drive to install Chromium OS onto before you can install it to your hard drive. Is there a way to install Chromium OS onto your hard drive without a handy 4GB USB disk? It would be nice if I could dual-boot it with Linux or Windows as well.


List currently running cron tab and stop it

I created a cronjob, it runs for a very long time but now don't know how to stop it. Please help.


Appending to same array in various loops, only last values remain Bash 4

I have something like this:               FILES=()     for i in *.map     do         FILES+=($i)     done          find /var/candy -name "chocolate_[0-9]" | while read snack     do         FILES+=($snack)     done          for file in ../out/amsterdam/apples/{system.map,vmlinux}     do         FILES+=($file)     done      But the array ends up only containing `../out/amsterdam/apples/system.map` and `../out/amsterdam/apples/vmlinux`. What happened to the other values? I know they exist in those loops because I echoed to make sure the variables contained something.


How to enable force feedback in kernel 2.6.34 - 64 bit?

The wheel is `Logitech driving force DFGT`. The platform:               linux-dopx:/home/anisha/ # cat /etc/issue && uname -a      Welcome to openSUSE 11.3 "Teal" - Kernel \r (\l).     Linux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/Linux      To check the force feedback I did:               linux-dopx:/home/anisha/ # fftest /dev/input/event4     Force feedback test program.     HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES          Device /dev/input/event4 opened     Axes query:     Effects:     Number of simultaneous effects: 0     Upload effects[0]: Function not implemented     Upload effects[1]: Function not implemented     Upload effects[2]: Function not implemented     Upload effects[3]: Function not implemented     Upload effects[4]: Function not implemented     Upload effects[5]: Function not implemented     Enter effect number, -1 to exit      fftest failed with `Function not implemented` message.   The wheel is being detected through event4 and js0 files in /dev/input/               # cat /proc/bus/input/devices     shows:     I: Bus=0003 Vendor=046d Product=c29a Version=0111     N: Name="Driving Force GT"     P: Phys=usb-0000:00:1d.3-1/input0     S: Sysfs=/devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input7     U: Uniq=     H: Handlers=event4 js0     B: EV=1b     B: KEY=1f0000 0 0 0 0 0 0 ffff00000000 0 0 0 0     B: ABS=30007     B: MSC=10      How to counter this? No, I am not running any game. I just wanted to apply these effects to my wheel. I even tried `modprobe hid-logitech` and `modprobe hid`, they didn't help. Please help.


This doesn't make sense to me, why would there be a load of 5 if there are zero processes in the runq?               12:00:01 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15     12:05:01 AM         0       708      5.23      5.14      5.10     12:15:01 AM         0       708      5.16      5.12      5.09     12:25:01 AM         0       708      5.07      5.07      5.08     12:35:01 AM         0       708      5.12      5.08      5.07     12:45:01 AM         2       708      5.18      5.15      5.09     12:55:01 AM         1       708      5.05      5.12      5.09     01:05:01 AM         0       708      5.06      5.08      5.08     01:15:01 AM         0       708      5.14      5.11      5.09      I know iowait is often the culprit for driving up the reported load, but there's very little disk activity,               12:00:01 AM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util     12:05:01 AM    dev8-0      1.53      0.00     30.61     20.01      0.00      0.34      0.21      0.03     12:15:01 AM    dev8-0      1.32      0.00     25.77     19.51      0.00      0.34      0.10      0.01     12:25:01 AM    dev8-0      1.60      0.00     40.81     25.43      0.00      0.64      0.29      0.05     12:35:01 AM    dev8-0      1.64      0.00     35.76     21.80      0.00      0.73      0.22      0.04     12:45:01 AM    dev8-0      1.33      0.00     25.95     19.51      0.00      0.23      0.12      0.02      The box itself is running a django instance and handling about 5 hits/sec.


Can I use my own ld.so.cache?

`ldconfig` has two interesting options:               -f conf           Use conf instead of /etc/ld.so.conf.     -C cache           Use cache instead of /etc/ld.so.cache.      I tried copying `/etc/ld.so.conf` to my own home directory, and edited it to include paths to my local libraries e.g. `/home/syockit/local/usr/lib` etc. And ran               ldconfig -f /home/syockit/ld.so.conf -C /home/syockit/ld.so.cache      and subsequently, to confirm that the libraries are cached, I ran               ldconfig -f /home/syockit/ld.so.conf -C /home/syockit/ld.so.cache -p | less      and it does include all my libraries on top of also including system libraries. Now, I want to have the default linker use these two. But in `man ld.so`, I see no mention of being able to use custom `.conf` or `.cache`. So what's the point of the above two options of `ldconfig` then?


Mount Drive Unplugged, Folder Still Writable

I created a folder using `sudo mkdir /mnt/external/` and then mount an external hdd to it:               $ mount -t ext2 /dev/sdd1 /mnt/external      I have an application writing backups to that mounted drive. Then, for fail test I simply unplug the external drive but the the application still keeps writing backups to that folder. This is a problem because `/mnt/external/` folder now becomes a regular folder on the regular hard drive and the application fills up the actual hard drive which is running the OS. How can I make sure that the application only writes to the mount point if the drive is currently mounted there?


replacing text and deleting text using awk in file using

I have a script and I want to do some replace and delete operations on it. I used `sed` to extract values between words `SendCommands` and `end` like this               sed -n '/SendCommands/,/end/p' ddtt      As `awk` was not giving me desired output so I'm sticking with this. I pasted the output here just show how it looks like :output `sed` is giving the function and comment part. How do I put multiple such occurrences in a file into an array and perform search and replace or delete one text/command at a time. Like delete `access-list 4 permit 10.59.230.14;\` or `service timestamps debug datetime msec localtime show-timezone;\` etc or replace `service timestamps debug datetime msec localtime show-timezone` or `service timestamps debug datetime msec localtime show-timezone` INFO: SendCommands is actualy a function used in the script


After updating sSMTP to version 2.61 I cannot send mail via gmail

I updated sSMTP to version 2.61 and now when I try to us it I receive the following error:               ssmtp: Cannot open smtp.gmail.com:587      I can connect via telnet to their address, but sSMTP seems to get tripped up and Im not sure what changed after the update. Here is the `ssmtp.conf`               root=XXXXX@gmail.com     mailhub=smtp.gmail.com:587     RewriteDomain=gmail.com     Hostname=localhost     UseTLS=YES     UseSTARTTLS=Yes     AuthUser=XXXXX     AuthPass=XXXXX     FromLineOverride=yes      Output when connecting via telnet:               [root@soupcan sbin]# telnet smtp.gmail.com 587     Trying 74.125.142.108...     Connected to smtp.gmail.com.     Escape character is '^]'.     220 mx.google.com ESMTP l7sm7330049igx.2 - gsmtp     quit     221 2.0.0 closing connection l7sm7330049igx.2 - gsmtp     Connection closed by foreign host.      And the output when I try to use `sSMTP`               [root@soupcan sbin]# /usr/sbin/ssmtp -v XXXXX@gmail.com < /home/user/Documents/Scripts/msg.txt     [<-] 220 mx.google.com ESMTP f5sm7367852igc.4 - gsmtp     [->] EHLO localhost     [<-] 250 CHUNKING     [->] STARTTLS     [<-] 220 2.0.0 Ready to start TLS     ssmtp: Cannot open smtp.gmail.com:587      **EDIT** Turning on debug logging I now see this, Im still digging:               SSL not working: certificate verify failed (20)      **EDIT 2** This has been resolved by adding the following to my `ssmtp.conf` file               TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt      Found information from HERE and HERE


Firefox unable to access domains defined in /etc/hosts if Network Manager is disconnected from a network

For developing web sites, I define test domains in /etc/hosts :               127.0.0.1 example.org      I can then access example.org in the browsers. However I when the Network Manager is not connected to any network, Firefox is not able to access `example.org`, it gives an error similar to DNS failure. It cannot even load the localhost, if I try to access it by the host name of my machine - i.e. `http://rohit-box`. I can access example.org, rohit-box, etc. in Chrome. I can also ping them successfully. Thus I have isolated the problem to Firefox. I am using Linux Mint 13 Cinnamon, Firefox 19. Edit - I also tried resetting Firefox from the Help menu. The issue persists.


Ctrl-s hang terminal emulator?

I came across a sentence in vimdoc:               Note: CTRL-S does not work on all terminals and might block                     further input, use CTRL-Q to get going again.      and this key indeed hangs my vim. I was thinking that it was the fault of vim, since there was no problem when I use `C-s`/`C-x C-s` in emacs nox. However just now when I was reading a manpage and pressed the `Ctrl-s`, it hangs `man` as well(I am setting `less` as the PAGER). So can someone tell me what's happening? The terminal emulators are `xterm` and `lxterminal`, and `tty` also has this problem. And a `Ctrl`+`q` puts the process right again in all the cases.


How to check if hot-swap or hot-plug are activated on my Linux machine

I have Ubuntu 12.04.1 LTS 64-bit on a PowerEdge 2900. My current setup has two 300GB disks (no RAID), but I want migrate the system to three new 600GB disks. I'm trying to connect the new disks, make a RAID5 array, and copy my partitions to the new RAID, but i'm not sure if the server has hot-plug support or, in particular, if it's activated. Looking at the system I get:               admin@host:~$ lsscsi -v     [4:0:0:0]    disk    HITACHI  HUS151414VLS300  A48B  /dev/sda       dir: /sys/bus/scsi/devices/4:0:0:0  [/sys/devices/pci0000:00/0000:00:05.0/0000:01:00.0/0000:02:08.0/host4/port-4:0/end_device-4:0/target4:0:0/4:0:0:0]     [4:0:1:0]    disk    HITACHI  HUS151414VLS300  A48B  /dev/sdb       dir: /sys/bus/scsi/devices/4:0:1:0  [/sys/devices/pci0000:00/0000:00:05.0/0000:01:00.0/0000:02:08.0/host4/port-4:1/end_device-4:1/target4:0:1/4:0:1:0]          admin@host:~$ lspci | grep '02:08.0'     02:08.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1068 PCI-X Fusion-MPT SAS (rev 01)      LSI SAS 1068 has hot-swap support according to the description, but I'm not sure, and I can't power-off the system for migration or check in bios. I'm afraid to just connect a disk in case it damages the controller or the disk itself, so I need a way to check if hot-plug/hot-swap is activated in the system.


How to connect to port immedeately, avoiding socket_bind(): unable to bind address?

When running a code that is supposed to read from a TCP/IP port I often get the following message (depending exactly what language have been used):               socket_bind(): unable to bind address      I know that this happens when some other process listens to this port / is binded to this port (I do not know the exact phrase to describe), and therefore my code cannot listen to that port. However, it is _my code_ which I just stopped (by CTRL-C) that is blocking this port! There seem to be some timeout involved, and after waiting some time (about 30 seconds) I can start my code to listen on this specific port without problems. I would like to know:   * Why is the port still blocked although I have stopped the code?   * How can I force the system to release this port so I can restart my code and start listening to this port?


How to edit files in-place while performing operation on the values matching the searched pattern?

Given a list files containing random text and many datetimes in ISO format in it (e.g "2012-07-02T10:47:24+02:00"), how can I find all these datetimes and add 2 hours to each one ? Ideally a solution that takes into account the fact that a day is 24 hours would be great (i.e "02T23:15 + 2" should result in "03T01:15" and not "02T25:15") but in my case that's not a big deal. And let's ignore the possible timezone consequences, and consider this as a simple math operation. I already know how to do this in Python for instance, reading all files line by line and replacing the line when datetimes are found but I wonder if there is a more straightforward way of doing this, with awk or sed maybe ? Thanks!


Huawei modem change auto answer settings

Is there a way to change Huawei modem ATS0=1 command to be permanently set, so that there would not be need to send that command every time when modem is plugged in ? On each modem-plugin command is by default ATS0=0, that means that modem auto call answer is disabled.


Non-graphical tty's not stretching full screensize

on tty7 (graphical environment) nothing's wrong, I can enjoy the whole pixels of my screen which is the main thing. But here's something a bit annoying, when I switch on terminals from 1 to 6, the visual space is shrunk to get into the upper left corner of my screen leaving the rest unused. worth a million words : ![pretty boring](http://i.stack.imgur.com/55HZb.png) _How can I fix that ?_ **update :** here's an shot of my screen ![enter image description here](http://i.stack.imgur.com/lydiN.jpg)


Making a IRQ SMP Affinity change permanent

I have to change the smp_affinity of a interrupt permanently. The following code needs to be executed when the server reboots:               echo "1" > /proc/irq/152/smp_affinity_list     echo "2" > /proc/irq/151/smp_affinity_list     echo "3" > /proc/irq/150/smp_affinity_list     echo "4" > /proc/irq/149/smp_affinity_list     echo "5" > /proc/irq/148/smp_affinity_list     echo "6" > /proc/irq/147/smp_affinity_list     echo "7" > /proc/irq/146/smp_affinity_list     echo "8" > /proc/irq/145/smp_affinity_list     echo "9" > /proc/irq/144/smp_affinity_list     echo "10" > /proc/irq/143/smp_affinity_list     echo "11" > /proc/irq/142/smp_affinity_list     echo "12" > /proc/irq/141/smp_affinity_list     echo "13" > /proc/irq/140/smp_affinity_list     echo "14" > /proc/irq/139/smp_affinity_list     echo "15" > /proc/irq/138/smp_affinity_list     echo "16" > /proc/irq/137/smp_affinity_list      I've added these lines to the /etc/rc.local file but the changes are not applied to the system. I've also added echo "test" > /root/test which gets executed properly, so the rc.local file gets executed. The system is running Debian 6.0.


Output of which command used for input to cd

I would like to take the output of a which command, and cd to the parent directory. For example, say I have the following:               which someprogram      With output:               /home/me/somedirectory/someprogram      And I would like to cd to the directory that someprogram lives in:               cd /home/me/somedirectory      I'd like to accomplish this in one line. What is the most elegant, tricky, short way to do this?


Configure OpenWRT as repeater

At home I'd like to configure one of my wifi routers to serve as a WI-FI signal extender. Since my main router is OpenWrt-based (Backfire 10.1.3), I'd like to use it for that purpose. I've looked into the problem and found that there is "Access Point (WDS)" option available in wifi interface setup. I thought this looks promising, especially since I've managed to configure my other router in that mode, too. However switching that option "on" doesn't do a thing. I've tried manually adding BSSID of the other side (WDS client) to /etc/config/wireless, but it didn't work. I still don't know where to configure security settings for the networks to pair (my network is WPA2 encrypted). The modem that would become a WDS client isn't running OpenWRT and I'm unable to get it installed there, so I'm trying with its current OS. But still, the main issue is with configuring OpenWRT side. Any ideas? EDITED: Found this two links: http://wiki.openwrt.org/doc/recipes/atheroswds https://forum.openwrt.org/viewtopic.php?id=11849 The first one gives not too many information, the second is rather outdated. Doesn't seem to work :(


how implement patch for change a arbitrary Governor in linux

> **Possible Duplicate:**   >  Implementing patch for changing a CPU frequency governor I am beginner in linux.I want implement a patch for change a arbitrary Governor in linux.not important what Governor be it.I only want some example for this work.thanks


I want to use a bluetooth keyboard during initram

I use _encryption_ on my hard drive. To boot I need to _type a password_ during initram to _decrypt_ the root partition. I'm running Archlinux on a tablet PC _without physical keyboard_ (only Bluetooth). For now I need to carry a USB keyboard with me in case I need to reboot. Note that I'm not always connected at boot (so early-ssh or mandos are not viable solutions). Does anyone know how to use bluetooth at boot ? Has anyone tried ? Solutions for Debian and derivated are also welcome, though I like Arch's way. PS : I assume this may seem illogical to weaken the security of my device (see comment), but I'm a _movable target_ and I _harldy_ have to type this password. Moreover, were I so concern about security I **wouldn't draw my bluetooth keyboard at all** , I just _don't want_ the drive to be readable once the pc down.


Wi-fi connection failing on Arch Linux

I' ve just installed Arch Linux on my computer, I have some problems: If I write               # iwconfig      The result is               -bash: iwconfig: command not found      the same is with `ifconfig` instead if I try with               # wifi-menu      I have               Please install 'dialog' to use wifi-menu      I don't have a modem to connect wire. What should I do?


Can't Install/Update packages on newly installed CentOS

I installed CentOS6 and it is the first time. I tried to install/update packages. But I coudn't. Here is the output and it doesn't stop. How can I solve this?               [root@localhost suranga]# yum update     Loaded plugins: fastestmirror, refresh-packagekit     Loading mirror speeds from cached hostfile      * base: mirror.nus.edu.sg      * extras: mirror.nus.edu.sg      * updates: mirror.nus.edu.sg     base                                                     | 3.7 kB     00:00          http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.


Losing wifi connection to access point after a few minutes (hostapd, dnsmasq, iptables)

I'm using a laptop as a wifi access point. Since this laptop has the proper hardware, I was able to use `hostapd`. I wanted to use DHCP and `iptables`/NAT forwarding instead of a bridge to have more control over the connection. I made a script to execute all commands. My devices are able to connect to the access point and have full access to the internet for the first few minutes. After this amount of time, no devices are able to connect to the access point anymore. The only way to re-establish a connection is if I reboot the laptop and relaunch the script. Here is my script:               #!/bin/bash     echo 1 > /proc/sys/net/ipv4/ip_forward          # Clear iptables Rules     iptables -F     iptables -t nat -F          # iptables Rules     iptables -A FORWARD -d 192.168.1.0/24 -o wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT     iptables -A FORWARD -s 192.168.1.0/24 -i wlan0 -j ACCEPT     iptables -t nat -A POSTROUTING -o p4p1 -j MASQUERADE          # Set wlan0 IP     ip addr add 192.168.1.1/24 broadcast 192.168.1.255 dev wlan0     ip link set wlan0 up          # Set DHCP     dnsmasq -C /dev/null >/dev/null 2>&1 --listen-address=192.168.1.1 --dhcp-range=192.168.1.2,192.168.1.200,12h          # hostapd     hostapd /etc/hostapd/hostapd.conf      Where `hostapd.conf` has the following content:               ctrl_interface=/var/run/hostapd     ctrl_interface_group=wheel     macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0     wpa=3     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP     rsn_pairwise=CCMP     wpa_passphrase=testomesto     driver=nl80211     interface=wlan0     hw_mode=g     channel=1     ssid=osumi-0      Additional information:   * Network hardware: Broadcom Corporation BCM4311 802.11a/b/g (rev 01)   * Network subsystem: Dell Wireless 1490 Dual Band WLAN Mini-Card   * Network driver: b43-pci-bridge   * OS: Fedora 17 (up to date) Below is an image of an iPod showing correct IP and router information ![enter image description here](http://i.stack.imgur.com/rgSFG.png)


Screen cuts off beginning of long command when accessed through bash history

I'm using the default versions of bash and screen in OS X Lion. When I'm in a screen session and I scroll back through the bash history and I come to a command that is long enough to wrap. I might first type some command:               selassid@tem02:~$ ls ljmix/fiftyfifty_softsphere/T0.350/r2.43/0.565421311859c0.1     83279836214c0.144847759343/      That wraps properly as written above, but if I press up to access it via bash's history, the console displays only:               83279836214c0.144847759343/      So the prompt and the entire first line of the command is missing, which makes it difficult to edit; if I scroll back to the first line, it appears but it overwrites the last line of output. When I execute the command, the rest of the first line is displayed and everything looks as expected:               selassid@tem02:~$ ls ljmix/fiftyfifty_softsphere/T0.350/r2.43/0.565421311859c0.1     83279836214c0.144847759343/     total 1792     ...     selassid@tem02:~$       What's more curious, is that if use the history to access the long command but I don't execute it yet, then use any `C-a` screen command, like switching to another window and then back, or if I click out of my current terminal window and back into it, the history command is now displayed properly again. My `PS1='\u@\h:\w$ '` so there's nothing strange going on there. Is there a way to correctly show the whole command when using the history? I've tried playing with the screen wrap settings, but they only make things worse. `stty -a` shows:               speed 9600 baud; 46 rows; 80 columns;     lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl         -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo         -extproc     iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8         -ignbrk brkint -inpck -ignpar -parmrk     oflags: opost onlcr -oxtabs -onocr -onlret     cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow         -dtrflow -mdmbuf     cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;         eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;         min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;         stop = ^S; susp = ^Z; time = 0; werase = ^W;


How to mount an IronKey in OpenBSD?

Being that it's proprietary, maybe this isn't possible but I was wondering if anybody was successful at mounting one of these in OpenBSD. I mounted the two partitions the USB drive creates which are `cd1a` and `cd1c` (cd rom emulation). Then I installed fedora base and turned on linux emulation in sysctl. `ldd` reveals all dependencies met. Running `./ironkey` gives:               Unable to initialize IKDevCore      Some sort of weird fedora error? Can't find any info. If all else fails maybe I can reformat the drive and just use it as hardware encrypted storage holding softraid partitions.


Where in "/" should extra disks be mounted?

According to Wikipedia http://en.wikipedia.org/wiki/Unix_directory_structure http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard extra disks should not be mounted in `/mnt/` according to the first link, but doesn't seams so according to the second link. Both say thought that they shouldn't be in `/media`. **Question** So where should extra permanent disks be mounted?


Use & (ampersand) in single line bash loop

I have been using this command successfully, which changes a variable in a config file then executes a Python script within a loop:               for((i=114;i<=255;i+=1)); do echo $i > numbers.txt;python DoMyScript.py; done      As each `DoMyScript.py` itself takes about 30 seconds to run before terminating, I'd like to relegate them to the background while the next one can be spawned. I have tried what I am familiar with, by adding in an ampersand as below:               for((i=114;i<=255;i+=1)); do echo $i > numbers.txt;python DoMyScript.py &; done      However, this results in the below error: > -bash: syntax error near unexpected token `;'


How to replicate (fork) the current terminal

Say I am using terminal and have `ssh`ed to a remote machine and did something.   How do I create a new terminal tab (or window) so I still has everything from the previous terminal window without having to do the whole thing like `ssh`, `cd`, etc. - just like forking. Then I can start working in the new window separately from the previous one.


Installing Epson Stylus SX115 printer on Archlinux

I have a printer 'Epson Stylus Sx115' plugged into my USB port. It is detected because it is listed in `lsusb`               Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard     Bus 001 Device 003: ID 05ac:8507 Apple, Inc. Built-in iSight     Bus 004 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)     Bus 004 Device 006: ID 04b8:084d Seiko Epson Corp. Stylus SX115     Bus 001 Device 006: ID 05ac:0221 Apple, Inc. Aluminum Keyboard (ISO)     Bus 001 Device 007: ID 05ac:0304 Apple, Inc. Optical USB Mouse [Mitsumi]     Bus 003 Device 002: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]     Bus 003 Device 003: ID 05ac:0237 Apple, Inc. Internal Keyboard/Trackpad (ISO)     Bus 004 Device 004: ID 05ac:8213 Apple, Inc.       I have CUPS installed as well as Gutenprint and the Epson driver from Avasys. However, when adding a new printer CUPS does not detect it so I can't install it. CUPS seems to be working because it is detecting my network printer (Brother DCP). How can I install my Epson printer? PS: I tried disabling the `usblp` module but without result.


What determines the path where the system searches for a file?

I am trying to get npm to work. In the process, I seem to have two versions of it installed: A corrupt one installed in ~/bin, and another I just compiled and ran `make install` to put it in `/usr/local/bin/npm`. So, I moved the entire ~/bin folder into ~/old/bin ... but still when I run `npm` the system searches in ~/bin:               $ which npm     /usr/local/bin/npm     $ alias npm     -bash: alias: npm: not found     $ npm     -bash: /home/ubuntu/bin/npm: No such file or directory     $ echo $PATH     /home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games     $      What causes Ubuntu to look for npm in `~/bin/npm` ? I'm using Ubuntu 11.10. I don't know if the question is ubuntu-specific or not, it can be moved to askubuntu if needed. I do see ~/bin in the PATH, but as far I as understand this only means that if npm was present at ~/bin then it would have used it ... but why does bash insist to look for it specifically there? Why doesn't it find `/usr/local/bin/npm`, even though the `which` command does find it?


Executing piped commands in parallel

Consider the following scenario. I have two programs A and B. Program A outputs to stdout lines of strings while program B process lines from stdin. The way to use these two programs is of course > foo@bar:~$ A | B Now I've noticed that this eats up only one core hence I am wondering > Are programs A and B sharing the same computational resources? If so, is > there a way to run A and B concurrently? Another thing that I've noticed is that A runs much much faster than B, hence I am wondering if could somehow run more B programs and let them process the lines that A outputs in parallel. That is, A would output its lines, and there would be N instances of programs B that would read these lines (whoever reads them first) process them and output them on stdout. So my final question is Is there a way to pipe the output to A among several B processes without having to take care of race conditions and other inconsistencies that could potentially arise?


Trying to Open a Port using CentOS

(I'm new to this!) I'm running a virtual server running CentOS. I'm trying to run a server that listens on port 37760. The code I'm running executes successfully, so I run               netstat -lptu      To show a list of ports listening, and               tcp        0      0 localhost.localdomain:37760 *:*      LISTEN      15006/node      is one of the entries. However, when I go to ip:37760 in my browser, the connection times out! I'm sure it's very obvious, but some help would be very helpful!! Thanks


Shell Prompt Customization?

I have used oh_my_zsh (and tinkered with bash_it) on multiple systems and have generally been happy with it, though I hate it's auto-correction feature and generally turn it off. My usual shell is zsh and I really want just three things from my prompt:   1. Current directory/or pwd.   2. Git status and branch.   3. Color output from ls (on the ls command, not in the prompt). The rest is just bling and is often irritating. By using these shell scripts I am paying too much in cpu cycles for what I want. Any suggestions, either with using these scripts or as a separate shell script. I am OK with either zsh or bash. Thanks.


What program displays volume/screen brightness under KDE?

It seems there's some bug in KDE related to power management and after putting my netbook to sleep several times, plugging it in and out, the notification about screen brightness set to 100% doesn't want to vanish (and as I modify brightness through keys, another one spawns right on top of the previous one, both half-transparent, two sets of numbers). Now, I could just kill the superfluous process if I ever knew how it's named. The notification, being an overlay, is "transparent" to 'xwininfo' and the likes. There's a tad too many processes I don't know to start killing by trial and error. Sure restarting X would help but I'd like to get by without reopening my sessions in everything I have open. Once I know what to kill/restart I should be able to solve it (and if I can't restart it, so be it, better no brightness indicator than one stuck!) So, what's the name of the process that displays this: ? ![enter image description here](http://i.stack.imgur.com/lns2U.png)


Use grep to find all files in a directory with two strings

I am trying to figure out the correct syntax to find two strings, the entire part of each string, anywhere (doesn't have to be near each other) in a file. So any file that has both `foo` and say the number `321`, doesn't have to be alone and can be a substring should match. I've tried the following without much luck:               grep 'foo\|321' *          grep 'foo|321'


SSH -L Tunnel no longer working

Local machine running my scripts needs to access a remote server's DB. Last week I could do, on the local machine `ssh -f -N -T -L1081:localhost:3306 ueser@remoteserver -p2222` on the local machine:               # netstat -an | egrep "tcp.*:1081.*"     tcp        0      0 127.0.0.1:1081          0.0.0.0:*               LISTEN          tcp6       0      0 ::1:1081                :::*                    LISTEN      then telling my scripts to use port 1081 for mysql connections worked. This netstat command shows me im accepting connections fine on the local side but the same check on the remote machine the one with the actual mysql server is not listening in on 1081 at all, which wasn't the case before I checked sshd_config which seems to allow tunnelling, that is no config change. I also tried opening a tunnel to another server on my network and that's also not working, is my command crap or something? Tried with various combinations of `-f -T`


IPsec Tunnel mode - RoadWarriors configuration

I've the need to configure IPsec tunnel mode between a gateway with static NAT (let's say its public IP is `172.31.0.105`) and a number of clients that are behind dynamic NAT. Reading through some resources (as this, this, and this) I've found that the roadwarrior configuration should work for my case. I've properly managed to setup and start racoon in both my gateway and in a test client, and when I try to setup the vpn from the client (`racoonctl vc -u user 172.31.0.105`) I obtain the banner specified in the server. But somehow something it's wrong, and they cannot communicate. Here is the `racoon.conf` on the gateway:               path certificate "/etc/racoon/certs";          listen {             adminsock disabled;             isakmp 172.31.0.105[500];             isakmp_natt 172.31.0.105[4500];     }          timer     {             natt_keepalive 600 sec;     }          # Phase 1 configuration     remote anonymous {         exchange_mode aggressive;              my_identifier asn1dn;         certificate_type x509 "cert.pem" "key.pem";              proposal_check claim;         generate_policy on;         verify_cert off;              nat_traversal on;         dpd_delay 20;            ike_frag on;                   proposal {             authentication_method hybrid_rsa_server;             encryption_algorithm 3des;             hash_algorithm md5;             dh_group 2;         }     }          # Local network information     mode_cfg {         network4 172.31.0.200;             netmask4 255.255.255.0;            dns4 8.8.8.8;                      #wins4 10.0.12.1;                   pool_size 10;                       auth_source system;                 banner "/etc/racoon/motd";          pfs_group 2;     }                    # Phase 2 proposal     sainfo anonymous {         pfs_group 2;         lifetime time 1 hour;         encryption_algorithm 3des;         authentication_algorithm hmac_md5;         compression_algorithm deflate;     }      Here is the `racoon.conf` on the test client:               path certificate "/etc/racoon";     path pre_shared_key "/etc/racoon/psk.txt";          listen {         adminsock "/var/racoon/racoon.sock" "root" "operator" 0660;     }          # Here is the address of the VPN gateway     remote 172.31.0.105 {       exchange_mode aggressive;       ca_type x509 "cacert.pem";       proposal_check obey;       nat_traversal on;       ike_frag on;       mode_cfg on;       passive off;       verify_cert off;       script "/etc/racoon/phase1-up.sh" phase1_up;       script "/etc/racoon/phase1-down.sh" phase1_down;       proposal {         encryption_algorithm 3des;         hash_algorithm md5;         authentication_method hybrid_rsa_client;         dh_group 2;       }     }               sainfo anonymous {             pfs_group 2;             lifetime time 1 hour;             encryption_algorithm 3des;             authentication_algorithm hmac_md5;             compression_algorithm deflate ;     }      Here are the dump of the SPD entries, while the set of SAD entries is empty:               root@test-client:/etc/racoon# setkey -PD     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=267 seq=1 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=276 seq=2 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=283 seq=3 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=292 seq=4 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=299 seq=5 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=308 seq=6 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=315 seq=7 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=324 seq=8 pid=2489         refcnt=1     172.31.0.200[any] 0.0.0.0/0[any] any         out prio def ipsec         esp/tunnel/192.168.66.105-172.31.0.105/require         created: May 23 13:30:05 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=345 seq=9 pid=2489         refcnt=1     0.0.0.0/0[any] 172.31.0.200[any] any         in prio def ipsec         esp/tunnel/172.31.0.105-192.168.66.105/require         created: May 23 13:30:05 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=352 seq=10 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:00 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=371 seq=11 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:00 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=380 seq=12 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:01 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=387 seq=13 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:01 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=396 seq=0 pid=2489         refcnt=1      The client succesfully setup a new network interface:               eth0:1    Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx                 inet addr:172.31.0.200  Bcast:172.31.255.255  Mask:255.255.0.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      but when from the gateway I try to ping the client (or also to establish a netcat session) using this virtual IP (`172.31.0.200`) I get an               Destination Host Unreachable