title: Black screen when installing Fedora 16

text: I have read many other threads here and elsewhere but found no solution... I'm trying to install Fedora 16 x86-64. At random points during installation I get black screens that do not go away. I have tried adding `nomodeset` to the kernel options (by far the most common answer to this kind of problems) but it didn't help. I also tried it with combination of `xdriver=vesa`, still with no success. I also tried `acpi=off`, `noapic`, `nolapic` and `noapictimer` combined with and without `nomodeset` with no success. Any suggestions? Btw, my machine has an Intel i7-950 CPU, 12 GB RAM, Gigabyte X58A-UD3R motherboard, an ATI 5870 graphics card (Gigabyte GV-R587UD-1GD Bios F8) and a couple of SATA hard drives.


title: how to make malware file readable with “No read permission on file” on linux ext-4?

text: There is an ongoing campaign of sending virus/trojans in e-mail messages faked as being from HSBC Bank, Lloyds TSB, Amazon etc. The trojan/virus is sent in a application/zip attachment. I've saved one such zip file and unpacked it in a directory owned by me with permission 700 on an ext4 file system In order to scan it with `clamscan`, `avgscan`, and `avast`, I've saved the zip file and unpacked its contents into a directory "virus":               File: /home/users/miller/virus     Size: 4096            Blocks: 8          IO Block: 4096   directory     Device: 809h/2057d      Inode: 14155801    Links: 2     Access: (0700/drwx------)  Uid: ( 1001/  miller)   Gid: ( 1000/   users)     Access: 2013-10-03 12:57:47.484923866 +0200     Modify: 2013-10-03 12:57:46.684879168 +0200     Change: 2013-10-03 12:57:46.684879168 +0200     Birth: -      As to be expected I can rename the file or delete it. The file has permissions 600 and is owned by me:               $ stat virus.exe     File: virus.exe     Size: 61440           Blocks: 120        IO Block: 4096   regular file     Device: 809h/2057d      Inode: 14155809    Links: 1     Access: (0600/-rw-------)  Uid: ( 1001/  miller)   Gid: ( 1000/   users)     Access: 2013-10-03 12:46:37.194541504 +0200     Modify: 2013-10-01 22:01:44.000000000 +0200     Change: 2013-10-03 13:19:09.263393591 +0200     Birth: -`      But any attempt to read the file or copy it fails.               $ file virus.exe     virus.exe: writable, regular file, no read permission`          cp virus.exe copy.exe     cp: cannot open virus.exe for reading: Operation not permitted`          lsattr virus.exe      lsattr: Operation not permitted While reading flags on virus.exe`      Even trying this as root fails. So how is it possible to make a file unreadable even though it has "rw permission" and how can it be made readable in order to scan it with `avgscan`, `clamscan`, `avast` etc? * * * _**_* CORRECTION _*_ *** (previous comment was for wrong zip file) Addendum: Running `clamscan` on the saved attachment zip file its-self results in no virus/trojan/malware being detected, probably because the internal executable file is in an "unreadable" state. clamscan virus.zip virus.zip: OK Similarly `avgscan` and `avast` fail to detect any malware. This highlights the importance of being able to read the extracted exe file and shows that `clamscan` is failing to detect malware. The original name of the zip file is `ORDER-N:N-1414559-3015133.zip` and the original name of the executable file is `Order details.exe`. * * * *** IMPORTANT ADDITIONAL INFORMATION *** To recap, if the zip file is unpacked by user miller, an exe file is created:               60 -rw-------   1 miller users 61440 2013-10-01 22:01 Order details.exe      but this is unreadable either by user miller or root. HOWEVER, if the zip file is unpacked by root, the exe file is readable by root:               0 -rw-r--r--  1 root root 61440 2013-10-01 22:01 Order details.exe      The file command shows the following:               [15:57] koala:{virus/}# file Order\ details.exe      Order details.exe: PE32 executable (GUI) Intel 80386, for MS Windows      So what is set that is preventing the ordinary user and root from reading the file unpacked by the user? The file unpacked by root:               $ lsattr Order\ details.exe      -------------e-- Order details.exe      The manual page for `chattr` explains:               The 'e' attribute indicates that the file is using extents for  mapping     the blocks on disk.  It may not be removed using chattr(1).      Thus on the ext2/3/4 file systems there is a catch22 situation -- the lack of readability of the file **CANNOT** be changed, and the solution is to unpack the zip archive as root to avoid creating the unpacked file with the "e" attribute since Linux unzip version does not have an ignore attributes switch. If the zip file is unpacked on an XFS file system by the user, then it is readable, because XFS does not support the attribute setting mechanism. And when `avgscan` is run on the exe file:               $ avgscan Order\ details.exe      AVG command line Anti-Virus scanner     Copyright (c) 2013 AVG Technologies CZ          Virus database version: 3222/6719     Virus database release date: Thu, 03 Oct 2013 06:11:00 +0200          Order details.exe  Found Luhe.Fiha.A          Files scanned     :  1(1)     Infections found  :  1(1)      So the moral of this story is **_do not trust_** `avgscan`, `avast`, or `clamscan` on always finding malware in zip files -- always do the scan on the unpacked executable!


title: xrandr configuration

text: How to change xrandr maximum value. > Screen 0: minimum 640 x 480, current 800 x 600, maximum 800 x 600 > > default connected 800x600+0+0 0mm x 0mm 800x600 60.0* > > 56.0 640x480 60.0 “1024x768_60.00″ (0x78) 63.5MHz >   >   >         h: width  1024 start 1072 end 1176 total 1328 skew    0 clock > 47.8KHz >   >         v: height  768 start  771 end  775 total  798           clock > 59.9Hz   >   > > “1024×768″ (0x79) 70.0MHz >   >   >         h: width  1024 start 1072 end 1176 total 1328 skew    0 clock > 52.7KHz >   >         v: height  768 start  771 end  775 total  798           clock > 66.1Hz >   where the minimum, maximum, and current value of xrandr will be store ? If I connect my monitor directly with machine I'm getting 1024x768. If I connect my monitor via KVM switch the maximum value is 800x600 how to change the max value?


title: Is it a good idea to put environment variables to /usr/local/bin

text: I'm using aws cfn to start ubuntu instances, and I need to pass variables provided in cfn launch script to the scripts on the instance. For example, I may pass "db-server=db-2.domain.com" and there is a number of scripts on the instance, that want to know this address. At the moment I create a file in /etc/profile.d setting vars with `export`, but this only works if bash is started as a login shell, which requires extra actions on my part to have these variables everywhere. So I though that maybe I could instead create files in /usr/local/bin, e.g. `get-db-host.sh` with `echo "db-2.domain.com"` as content, this way they would be available to each script with no changes required. Is it a good approach?


title: Mount NTFS Partition on Startup in Ubuntu

text: I have a 10 gigabyte partition which I use for files which I share between my Windows installation and my Oneiric Ocelet (Ubuntu) installation. My Eclipse workspaces exist on this partition. Eclipse loads up fine in Windows. In Ubuntu, however, if I have not mounted the partition manually, I receive an error about being unable to open the workspace. I know that that partition mounts to `/media/A476FC2E76FC033A`, is formatted as NTFS, and is the `/dev/sda4` partition. I know that I can change Ubuntu's filesystem table via modifying `fstab`, but I do not understand all of the options involved in doing so and would like to do this correctly. I appreciate any assistance any of you may be able to give to me.


title: How to only output a column that has constant neighbors?

text: INPUT               AA XXX Y1Y ZZZ GG dhz     rr (AAAa) XXX Y2Y ZZZ TT GGGG UU      OUTPUT               Y1Y     Y2Y      The input lines could vary.. only the XXX before the Y1Y and the ZZZ after Y1Y is constant (they are the neighbors of XXX and ZZZ like this). Y1Y could be anything, ex.: Y1Y, Y2Y, Y1T, etc. **Q:** how can I get the OUTPUT with awk or sed or grep? (or are there any better tool for this?) **UPDATE** (problem): why doesn't it works when having "." in the Y1Y?               [user@notebook ~] echo 'XXX Y1Y ZZZ' | grep -Po "(?<=XXX )(\w+)(?= ZZZ)"     Y1Y     [user@notebook ~] echo 'XXX Y1.Y ZZZ' | grep -Po "(?<=XXX )(\w+)(?= ZZZ)"     [user@notebook ~]


title: Getting the complete command line that caused an ERR , while trap

text: How do I make trap to return the command that caused an ERR?               $function err_handler() { echo "$0 caused the error"; }          $ trap err_handler ERR          $ grep -ci "failed" test4 &>/dev/null     -bash caused the error      I wanted the output like               grep caused the error      and possibly ( greedy enough ) to have the entire substituted command line. Is it possible ( without any hacks )? EDIT: I apologize for not mentioning that my shell is KSH.


title: Why FreeRADIUS service won't work on Centos ?

text: I have installed FreeRADIUS server on centos via yum successfully, but I couldn't start radiusd service. when I run as root user and exec the following **radiusd -X** an error is occurred.               [root@IgorAAA /]# sudo radiusd -X     FreeRADIUS Version 2.1.12, for host i386-redhat-linux-gnu, built on Oct  3 2012 at 01:20:08     Copyright (C) 1999-2009 The FreeRADIUS server project and contributors.      There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A      PARTICULAR PURPOSE.      You may redistribute copies of FreeRADIUS under the terms of the      GNU General Public License v2.      Starting - reading configuration files ...     including configuration file /etc/raddb/radiusd.conf     including configuration file /etc/raddb/proxy.conf     including configuration file /etc/raddb/clients.conf     including files in directory /etc/raddb/modules/     including configuration file /etc/raddb/modules/sqlcounter_expire_on_login     including configuration file /etc/raddb/modules/otp     including configuration file /etc/raddb/modules/counter     including configuration file /etc/raddb/modules/passwd     including configuration file /etc/raddb/modules/smbpasswd     including configuration file /etc/raddb/modules/perl     including configuration file /etc/raddb/modules/chap     including configuration file /etc/raddb/modules/realm     including configuration file /etc/raddb/modules/acct_unique     including configuration file /etc/raddb/modules/detail     including configuration file /etc/raddb/modules/logintime     including configuration file /etc/raddb/modules/detail.example.com     including configuration file /etc/raddb/modules/unix     including configuration file /etc/raddb/modules/linelog     including configuration file /etc/raddb/modules/replicate     including configuration file /etc/raddb/modules/checkval     including configuration file /etc/raddb/modules/ldap     including configuration file /etc/raddb/modules/rediswho     including configuration file /etc/raddb/modules/redis     including configuration file /etc/raddb/modules/mac2ip     including configuration file /etc/raddb/modules/attr_rewrite     including configuration file /etc/raddb/modules/radutmp     including configuration file /etc/raddb/modules/cui     including configuration file /etc/raddb/modules/detail.log     including configuration file /etc/raddb/modules/smsotp     including configuration file /etc/raddb/modules/dynamic_clients     including configuration file /etc/raddb/modules/pam     including configuration file /etc/raddb/modules/digest     including configuration file /etc/raddb/modules/expiration     including configuration file /etc/raddb/modules/sql_log     including configuration file /etc/raddb/modules/ntlm_auth     including configuration file /etc/raddb/modules/exec     including configuration file /etc/raddb/modules/attr_filter     including configuration file /etc/raddb/modules/files     including configuration file /etc/raddb/modules/inner-eap     including configuration file /etc/raddb/modules/soh     including configuration file /etc/raddb/modules/mac2vlan     including configuration file /etc/raddb/modules/opendirectory     including configuration file /etc/raddb/modules/preprocess     including configuration file /etc/raddb/modules/ippool     including configuration file /etc/raddb/modules/echo     including configuration file /etc/raddb/modules/always     including configuration file /etc/raddb/modules/etc_group     including configuration file /etc/raddb/modules/pap     including configuration file /etc/raddb/modules/wimax     including configuration file /etc/raddb/modules/mschap     including configuration file /etc/raddb/modules/policy     including configuration file /etc/raddb/modules/expr     including configuration file /etc/raddb/modules/sradutmp     including configuration file /etc/raddb/eap.conf     including configuration file /etc/raddb/policy.conf     including files in directory /etc/raddb/sites-enabled/     including configuration file /etc/raddb/sites-enabled/default     including configuration file /etc/raddb/sites-enabled/inner-tunnel     including configuration file /etc/raddb/sites-enabled/control-socket     main {         user = "radiusd"         group = "radiusd"         allow_core_dumps = no     }     including dictionary file /etc/raddb/dictionary     main {         name = "radiusd"         prefix = "/usr"         localstatedir = "/var"         sbindir = "/usr/sbin"         logdir = "/var/log/radius"         run_dir = "/var/run/radiusd"         libdir = "/usr/lib/freeradius"         radacctdir = "/var/log/radius/radacct"         hostname_lookups = no         max_request_time = 30         cleanup_delay = 5         max_requests = 1024         pidfile = "/var/run/radiusd/radiusd.pid"         checkrad = "/usr/sbin/checkrad"         debug_level = 0         proxy_requests = yes      log {         stripped_names = no         auth = no         auth_badpass = no         auth_goodpass = no      }      security {         max_attributes = 200         reject_delay = 1         status_server = yes      }     }     radiusd: #### Loading Realms and Home Servers ####      proxy server {         retry_delay = 5         retry_count = 3         default_fallback = no         dead_time = 120         wake_all_if_all_dead = no      }      home_server localhost {         ipaddr = 127.0.0.1         port = 1812         type = "auth"         secret = "testing123"         response_window = 20         max_outstanding = 65536         require_message_authenticator = yes         zombie_period = 40         status_check = "status-server"         ping_interval = 30         check_interval = 30         num_answers_to_alive = 3         num_pings_to_alive = 3         revive_interval = 120         status_check_timeout = 4       coa {         irt = 2         mrt = 16         mrc = 5         mrd = 30       }      }      home_server_pool my_auth_failover {         type = fail-over         home_server = localhost      }      realm example.com {         auth_pool = my_auth_failover      }      realm LOCAL {      }     radiusd: #### Loading Clients ####      client localhost {         ipaddr = 127.0.0.1         require_message_authenticator = no         secret = "testing123"         nastype = "other"      }     radiusd: #### Instantiating modules ####      instantiate {      Module: Linked to module rlm_exec      Module: Instantiating module "exec" from file /etc/raddb/modules/exec       exec {         wait = no         input_pairs = "request"         shell_escape = yes       }      Module: Linked to module rlm_expr      Module: Instantiating module "expr" from file /etc/raddb/modules/expr      Module: Linked to module rlm_expiration      Module: Instantiating module "expiration" from file /etc/raddb/modules/expiration       expiration {         reply-message = "Password Has Expired  "       }      Module: Linked to module rlm_logintime      Module: Instantiating module "logintime" from file /etc/raddb/modules/logintime       logintime {         reply-message = "You are calling outside your allowed timespan  "         minimum-timeout = 60       }      }     radiusd: #### Loading Virtual Servers ####     server { # from file /etc/raddb/radiusd.conf      modules {       Module: Creating Auth-Type = digest       Module: Creating Post-Auth-Type = REJECT      Module: Checking authenticate {...} for more modules to load      Module: Linked to module rlm_pap      Module: Instantiating module "pap" from file /etc/raddb/modules/pap       pap {         encryption_scheme = "auto"         auto_header = no       }      Module: Linked to module rlm_chap      Module: Instantiating module "chap" from file /etc/raddb/modules/chap      Module: Linked to module rlm_mschap      Module: Instantiating module "mschap" from file /etc/raddb/modules/mschap       mschap {         use_mppe = yes         require_encryption = no         require_strong = no         with_ntdomain_hack = no         allow_retry = yes       }      Module: Linked to module rlm_digest      Module: Instantiating module "digest" from file /etc/raddb/modules/digest      Module: Linked to module rlm_unix      Module: Instantiating module "unix" from file /etc/raddb/modules/unix       unix {         radwtmp = "/var/log/radius/radwtmp"       }      Module: Linked to module rlm_eap      Module: Instantiating module "eap" from file /etc/raddb/eap.conf       eap {         default_eap_type = "md5"         timer_expire = 60         ignore_unknown_eap_types = no         cisco_accounting_username_bug = no         max_sessions = 4096       }      Module: Linked to sub-module rlm_eap_md5      Module: Instantiating eap-md5      Module: Linked to sub-module rlm_eap_leap      Module: Instantiating eap-leap      Module: Linked to sub-module rlm_eap_gtc      Module: Instantiating eap-gtc        gtc {         challenge = "Password: "         auth_type = "PAP"        }      Module: Linked to sub-module rlm_eap_tls      Module: Instantiating eap-tls        tls {         rsa_key_exchange = no         dh_key_exchange = yes         rsa_key_length = 512         dh_key_length = 512         verify_depth = 0         CA_path = "/etc/raddb/certs"         pem_file_type = yes         private_key_file = "/etc/raddb/certs/server.pem"         certificate_file = "/etc/raddb/certs/server.pem"         CA_file = "/etc/raddb/certs/ca.pem"         private_key_password = "whatever"         dh_file = "/etc/raddb/certs/dh"         random_file = "/etc/raddb/certs/random"         fragment_size = 1024         include_length = yes         check_crl = no         cipher_list = "DEFAULT"         cache {         enable = no         lifetime = 24         max_entries = 255         }         verify {         }         ocsp {         enable = no         override_cert_url = yes         url = "http://127.0.0.1/ocsp/"         }        }      Module: Linked to sub-module rlm_eap_ttls      Module: Instantiating eap-ttls        ttls {         default_eap_type = "md5"         copy_request_to_tunnel = no         use_tunneled_reply = no         virtual_server = "inner-tunnel"         include_length = yes        }      Module: Linked to sub-module rlm_eap_peap      Module: Instantiating eap-peap        peap {         default_eap_type = "mschapv2"         copy_request_to_tunnel = no         use_tunneled_reply = no         proxy_tunneled_request_as_eap = yes         virtual_server = "inner-tunnel"         soh = no        }      Module: Linked to sub-module rlm_eap_mschapv2      Module: Instantiating eap-mschapv2        mschapv2 {         with_ntdomain_hack = no         send_error = no        }      Module: Checking authorize {...} for more modules to load      Module: Linked to module rlm_preprocess      Module: Instantiating module "preprocess" from file /etc/raddb/modules/preprocess       preprocess {         huntgroups = "/etc/raddb/huntgroups"         hints = "/etc/raddb/hints"         with_ascend_hack = no         ascend_channels_per_line = 23         with_ntdomain_hack = no         with_specialix_jetstream_hack = no         with_cisco_vsa_hack = no         with_alvarion_vsa_hack = no       }      Module: Linked to module rlm_realm      Module: Instantiating module "suffix" from file /etc/raddb/modules/realm       realm suffix {         format = "suffix"         delimiter = "@"         ignore_default = no         ignore_null = no       }      Module: Linked to module rlm_files      Module: Instantiating module "files" from file /etc/raddb/modules/files       files {         usersfile = "/etc/raddb/users"         acctusersfile = "/etc/raddb/acct_users"         preproxy_usersfile = "/etc/raddb/preproxy_users"         compat = "no"       }     /etc/raddb/users[3]: Syntax error: Previous line is missing a trailing comma for entry alice     Errors reading /etc/raddb/users     /etc/raddb/modules/files[7]: Instantiation failed for module "files"     /etc/raddb/sites-enabled/default[170]: Failed to load module "files".     /etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.      [root@IgorAAA /]# service radiusd status     radiusd is stopped      Any ideas on how to fix it and start the radiusd service?


title: Set environment variable automatically upon SSH login (no root access)

text: The situation: I run Ubuntu 12.04 LTS on a virtual machine. I regularly have to connect to my account on a university server, I do this by opening up terminal and using `ssh -Y username@server.com`. Once there I always have to run the following `setenv PYTHONPATH "place/stuff/this_goes_on_forever"` And also a few other lines of code. What I want:   1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.    2. This is a side query, but when I use `alias p="pwd"` (for example) the new aliases do not 'take', typing `p` in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps? Attempts at a solution: I tried adding `export PYTHONPATH="..."` to my local `~/.bashrc` file which means when I start terminal `PYTHONPATH` is set, however after I `ssh` to the server it is no longer set (well I have a whole new host of environment variables). I tried `~/.bash_profile` after, didn't work. I have tried adding `export PYTHONPATH="..."` to the `~/.bash_profile` file on the server, and also to the `~/.bashrc` file- but neither worked. I do not have root access on the server so cannot change `AcceptEnv` or `PermitUserEnvironement` within the `sshd_config` file on the server, it is just read-only. Surely there is somewhere I can put this code, I just can't find where.


title: Adding files to a cell phone connected via USB

text: My goal is to add files (in particular, a ringtone) to my LG GS170 cell phone. I'm running Ubuntu linux (and crunchbang on another machine, but the same problem persists there). When I plug the phone into my machine via USB, I see it when I run `lsusb`: > Bus 002 Device 008: ID 1004:6000 LG Electronics, Inc. VX4400/VX6000 > Cellphone but it doesn't show up in the `/media` directory as I'd hoped it would. Thus my question is: **How can I add files to my phone when it's connected via usb to my machine?** **Edit:** Below is what was output when I ran `sudo udevadm monitor` and then plugged in my phone. > monitor will print the received events for: UDEV - the event which udev > sends out after rule processing KERNEL - the kernel uevent > > KERNEL[1320439577.540674] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1 (usb) KERNEL[1320439577.553409] > add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0 (usb) > KERNEL[1320439577.555385] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.1 (usb) > KERNEL[1320439577.558373] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.2 (usb) UDEV > [1320439577.580299] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1 (usb) UDEV > [1320439577.621843] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.1 (usb) UDEV > [1320439577.621894] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.2 (usb) > KERNEL[1320439577.652034] add /module/cdc_acm (module) UDEV > [1320439577.652421] add /module/cdc_acm (module) KERNEL[1320439577.655490] > add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/tty/ttyACM0 (tty) > KERNEL[1320439577.655541] add /bus/usb/drivers/cdc_acm (drivers) UDEV > [1320439577.655762] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0 (usb) UDEV > [1320439577.656031] add /bus/usb/drivers/cdc_acm (drivers) UDEV > [1320439577.871264] add   >  /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/tty/ttyACM0 (tty)


title: How do I track all the most recent file changes on my UNIX system?

text: Say, either for a Debian system or a Red Hat one.


title: centos5 maximum memory setting for all users

text: I'm using Centos5 for operating server and the machine has limited memory. There are many users using the server and some of them are running programs which use a lot of RAM. When I check the used memory using top, both the RAM and the Swap are occupied by only a small number of users. So, I would likely to enforce a memory usage limit for each user. How can I enforce such a limitation?


How to check if VT-X is enabled in BIOS? I have `vmx` in CPU flags, and no access to the BIOS. (I need to install a KVM VM on RedHat Enterprise Linux 6.1).


title: Avoid issues with Fedora and Windows by installing on separate hard drives?

text: I just built my first Linux machine (Fedora distribution) and love it. For my professional work, having access to Windows would help tremendously, and I'd like to be install Windows and have a choice of OS upon boot: Fedora or Windows. I've also read a lot on how to do this and a common warning I see is, "Be careful, Windows will overwite the Master Boot Record with its own instruction set." My (seemingly) simple question is - can I physically install another hard drive, install Windows on that disk, and, if I want to use Windows, change the boot order in BIOS to make this disk the first?


title: Get rid of *~ files in KDE editors

text: All the KDE based editors (Kate, KWrite, Kile, etc.) tend to produce recovery (?) files that are named like the edited file with a tilde at the end. The annoying thing is that these files are left even after I quit the editor. How can I disable this behaviour? I don't mind having these while I am editing (if they help with anything), but I don't want them after I finish.


title: ping receives no packets, but tcpdump can see them coming in

text: I'm migrating an old Ubuntu OpenVZ instance (Jaunty) to a new CentOS 6.3 host (using vzdump/vzrestore). Now networking does not work properly. Facts:   * It works just fine if a setup a new OpenVZ instance.   * I can connect INTO the old instance perfectly well, but it cannot connect to the outside.   * It cannot ping the host, nor anything else.   * I've cleared all iptables rules both on host and inside the VE. ping:               root@dolores:/# ping 8.8.8.8     PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.     ^C     --- 8.8.8.8 ping statistics ---     11 packets transmitted, 0 received, 100% packet loss, time 9999ms      At the same time within the VE:               17:49:12.730360 IP dolores > 8.8.8.8: ICMP echo request, id 59701, seq 1, length 64     17:49:12.735095 IP 8.8.8.8 > dolores: ICMP echo reply, id 59701, seq 1, length 64     17:49:13.730305 IP dolores > 8.8.8.8: ICMP echo request, id 59701, seq 2, length 64     17:49:13.735524 IP 8.8.8.8 > dolores: ICMP echo reply, id 59701, seq 2, length 64     17:49:14.730411 IP dolores > 8.8.8.8: ICMP echo request, id 59701, seq 3, length 64      This output occasionally occurs with some delay, I believe because tcpdump tries to reverse-DNS the ips involved:               17:47:20.977819 IP dolores.40623 > 213.133.98.97.domain: 60247+ PTR? 8.8.8.8.in-addr.arpa. (38)      I can run tcpdump on the host and get the same output immediately. Of course, `/sys/devices/virtual/net/venet0/statistics/rx_bytes` is updating, and none of the `/sys/devices/virtual/net/venet0/statistics/rx_` error files make a peep. What's the deal? Where would I look now? The problem must be related to the Ubuntu VE itself, I assume, since it works with newly created ones. Some more output in case it helps:               root@dolores:/# ifconfig -a     lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                 inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255               UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1               RX packets:39652 errors:0 dropped:0 overruns:0 frame:0               TX packets:39398 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:3344760 (3.3 MB)  TX bytes:3303115 (3.3 MB)          venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                 inet addr:78.46.236.xxx  P-t-P:78.46.236.xxx  Bcast:0.0.0.0  Mask:255.255.255.255               UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1      .               root@dolores:/# route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     default         *               0.0.0.0         U     0      0        0 venet0      On the host:               [root@olive ~]# route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     static.xxx.236. *               255.255.255.255 UH    0      0        0 venet0     78.46.236.xxx   *               255.255.255.224 U     0      0        0 eth0     link-local      *               255.255.0.0     U     1002   0        0 eth0     default         gw-wan2.little- 0.0.0.0         UG    0      0        0 eth0


title: Can you use grub to boot a RW partition file stored on a FAT32 HDD?

text: This is a bit tricky question. I have a Ubuntu 11.10 installed onto a USB 16GB Flash drive. I used the Ubuntu installer to do this. It runs great! Except the I/O is slow. I also have a 250GB USB external HDD with one partition formatted as a FAT32 file system which I use to store all my data. Here is the crux. I'd like to directly copy my USB Flash system to the USB external HDD. To do this and still maintain the Linux ext2 file system I would need to make a 16GB image (would that e called an IMG or ISO?) which is read/writable. Then move that image to a directory on the FAT32 HDD. Then place a grub2 install to the HDD's MBR. Is this correct? Or am I missing something? And how would one do this? The GRUB2 documentation is a bit confusing in this context. I do not wish to loos my FAT32 drive. Can you boot to a read/write file image stored within a FAT32 partition or are you required to re-partition a drive? And if this is possible can anyone offer the steps to do this?


title: How can I block a range of IP addresses with an Amazon EC2 instance?

text: I know a certain range of IP addresses are causing problem with my server, `172.64.*.*` what is the best way to block access to my Amazon EC2 instance? Is there a way to do this using security groups or is it better to do it with the firewall on the server itself?


title: On a dual head system, how can I force the placement of a window to a certain desktop?

text: The relevant output of my xrandr configuration:               xrandr -q     Screen 0: minimum 320 x 200, current 2304 x 1024, maximum 8192 x 8192     LVDS1 connected 1024x768+0+0 (normal left inverted right x axis y axis)                VGA1 connected 1280x1024+1024+0 (normal left inverted right x axis y axis)       Just as an examle; let's say I would launch gvim from the commandline, how could I force the application window to be displayed on output `VGA1`? As a desktop environment I am using **Unity** with **compiz** enabled. Maybe there's a way to do this within compiz if I can't do it straight from the cli (which I would prefer)?


title: Is S25mdadm start script priority correct?

text: (On Ubuntu 11.10 - configuration inherited from 10.10) Occasionally the boot process seems to suffer a race condition where a starting process misses some of the Raid-1 FSes, build via mdadm. Looking at the start script, runlevel 5, (3 is similar anyway)               K00ntop     S15bind9     S16openvpn     S20kerneloops     S20nfs-kernel-server     S20nginx     S20php5-fpm     S20postfix     S20speech-dispatcher     S20winbind     S20xinetd     S23ntp     S25bluetooth     S25mdadm     ... There a bunch of processes started before mdadm, and nginx has some of web data on a MD array. While it's unlikely someone accesses the server at this very time, I wonder if it could be the reason. Actually, I'm a bit surprised `mdadm` to be started that late in the boot process.   Is it not/recommended to run it earlier, say S10?


title: Tar a file with a different name

text: To make my environment deployable, I occasionally tar up some handy files and scripts:               tar -czvf env.tgz .vimrc .vim/ bin/lsl bin/s      I would like to add `.bashrc` to the mix, but I have some sensitive information in there so I maintain `.bashrc-deploy` which I can then simply rename once the tarball is on the new server. However, I would really like to have the tarball have the correct name `.bashrc` from the get-go so that I would not have to rename. I considered writing a script which would temporarily rename the files and make the tarball, like so:               #!/bin/bash     mv .bashrc .bashrc-real     mv .bashrc-deploy .bashrc     tar -czvf env.tgz .bashrc .vimrc .vim/ bin/lsl bin/s     mv .bashrc .bashrc-deploy     mv .bashrc-real .bashrc      However, does `tar` have any internal way of storing `someFile` with the name `anotherName` in the tarball?


title: Search and replace next n words in vi

text: > **Possible Duplicate:**   >  Vim :s replace first N < g occurrences on a line In vi, how do I search and replace a word's first `n` occurrences with a word, say "hello", and the next `m` occurrences with `bonjour`, and all the rest with `namaste`?


title: Connection with hostapd stops working after 10 minutes

text: I have installed `hostapd` as package for Ubuntu 12.04. Everything is configured and works great for about 10 minutes; after that, packets start to get dropped and eventually I can't even connect. Restarting the hostapd service seems to fix everything for a further 10 minutes. I am fairly fresh to Linux. What steps I can take to further debug this behaviour?


title: How to catch a signal in command line?

text: I asked this question. `SIGPIPE` signal is generated to stop the execution of the command as told in the answer. But how do I capture this signal and gracefully terminate the command? The command exits with an error saying that it is a broken pipe. > [ERROR] [Errno 32] Broken pipe is the error message displayed


title: Avoiding errors due to unexpanded asterisk

text: In bash I often use for-loops such as the following               for file in *.type; do        sommecommand "$file";      done;      to perform an operation for all files matching `*.type`. If no file with this ending is found in the working directories the asterisk is not expanded and usually I will get an error message saying that somecommand didn't find the file. I can immediately think of several ways to avoid this error. But adding a conditional does not seem to be very elegant. Is there a short and clean way to achieve this?


title: getting 553 - cannot create file in vsftpd (ubuntu 12.04)

text: I'm trying to setup a ftp account for a user that has read/write access to one folder: /items/myuser I've set up the account with username 'myuser' in Linux with the adduser command. After that, I've changed my /etc/vsftpd.conf file to:               chroot_local_user=NO     chroot_list_enable=YES     user_config_dir=/etc/vsftpd_user_conf      I've also edited the /etc/vsftpd.chroot_list and added 'myuser' to this list. After that, I've edited /etc/vsftpd_user_conf/myuser and added the following line:               local_root = /items/myuser      After that, I've created this local_root folder and ran the following commands:               chown myuser:myuser /items/myuser     chmod ug-w /items/myuser          mkdir /items/myuser/homefolder     mount --bind /items/myuser /items/myuser/homefolder      I can login and I'm restricted to this folder and his subfolders but when I want to write a file, I'm getting an 553 error. Does anyone know what I've forgotten to do? Thanks in advance!


title: How can I (and should I) use my Linux file server as a Time Machine backup server for my Macs?

text: I have two Macs that I'd like to start backing up using Time Machine, but all of my storage is attached to my Linux file server. How can I use my Linux file server (which happens to be running Ubuntu Karmic) as a custom Time Capsule replacement, and have my Macs (running 10.6) automatically back up to it using Time Machine? And lastly, is this wise? Is there any inherent risk in doing this that compromises the whole point of the backup?


title: Check if the residence's connection has internet access

text: I'd like to be able to test if I have access to the internet. My computer is connected to the residence internet connection. I thought of using `ping` like this:               ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error      But this does not work! As I said the connection is provided by a residence(which is actually just forwarding the university connection). To have access to the internet you _must_ open a web browser where you are requested user name and password and only then the internet access is granted.(I really have no clue about networks configurations etc. and anyway I do not have any access to how it is setup, so I can't provide more information on this side) The above code prints "ok" even when I do not actually have access to the internet. Even testing with `www.google.com` fails. I believe this is because it is being redirected to the login page and it "thinks" to get back the packets correctly. How can I reliably check if I have access to the internet? ## Some context I'd like to connect to the computer in my room via `ssh` when I go home during weekends. The connection sometimes fails so I'd like to create a script that every once in a while checks for the connection and eventually starts a web browser and sends keystrokes using `xdotool` to login. If you know a better way to reopen the connection to allow `ssh` remote access than, please, write it too. **Update:** Some sample output of `nslookup`:               $ nslookup unix.stackexchange.com     Server:         127.0.1.1     Address:        127.0.1.1#53          Non-authoritative answer:     Name:   unix.stackexchange.com     Address: 69.59.197.21      The result is exactly the same both with internet access and without it. (I've also tried to log off and relog, and connect and disconnect multiple times). Also, I'd like to add that is not the `ssh` connection closing. For some time I'm able to create the connection, do things and log out. After some hours trying to do `ssh the-IP` gives a timeout error(I actually registered a no-ip account since the IP is dynamic so I'm doing `ssh mydomain.no-ip.org`).


title: Skype notifications with dual monitors

text: I went and installed Arch Linux with XFCE4 and it all went fine until I installed Skype. It went to the tray etc but I had 2 problems really.   1. Once I right clicked the icon on the tray, half of the menu went to the second monitor so it was hard to read the menu items.   2. The Skype notification popups were on the dual monitor, bottom right. I understand other people have had the problem but I can't find a solution as such. I'd primarily like it to show on my primary monitor, where Skype and the tray is.  I'd like to fix it on xfce4. Any ideas?


title: How to see output of a running program over ssh

text: I use debian 6 on an embedded system which is supposed to run a program called `pilot`. The OS is configured to login as root without asking password (there is no monitor nor keyboard connected). After login, `pilot` will run automatically. I need to see std output of the `pilot`. I'm connecting with ssh over wireless.


title: pdf viewer for command line only

text: Is it possible to view pdf documents without having gdm (or similar) running? Rationale: I'm working on a remote server (assume no X forwarding) processing some data, creating some plots (assume pdf files). And I would like to view them without having to `scp` and open them on my machine. (There may be other use cases, probably.)


title: Download list of files if they don't already exist

text: If I have a list of URLs separated by `\n`, are there any options I can pass to `wget` to download all the URLs and save them to the current directory, but only if the files don't already exist?


title: Pacman Full system upgrade failure

text: I'm trying to do a full system upgrade using pacman on ArchLinux. I have kernel 3.2. When typing `sudo pacman -Syu` I got the following errors               :: Synchronizing package databases...     core is up to date     extra is up to date     community is up to date     :: Starting full system upgrade...     error: could not parse package description file 'libice-1.0.8-1/desc' from db 'extra'     resolving dependencies...     warning: cannot resolve "p11-kit>=0.12", a dependency of "gnutls"     warning: cannot resolve "vim-runtime=7.3.495-1", a dependency of "gvim"     :: The following packages cannot be upgraded due to unresolvable dependencies:           gnutls  gvim          Do you want to skip the above packages for this upgrade? [y/N] y     looking for inter-conflicts...     error: failed to prepare transaction (could not satisfy dependencies)     :: nvidia: requires linux<3.3      I've tried to reinstall libice but I got the following error               error: could not parse package description file 'libice-1.0.8-1/desc' from db 'extra'     warning: libice-1.0.8-1 is up to date -- reinstalling     resolving dependencies...     looking for inter-conflicts...     error: failed to prepare transaction (package filename is not valid)      How can I fix this problem?


title: What's the next step in troubleshooting this wireless connection failure?

text: I just installed Ubuntu 10.04.3 to dual-boot with Windows. I can connect to the Internet using a wired connection, but not through wireless. The first time I booted, the wireless notification bar said "Device not ready". The next time I booted, the wireless notification didn't show any available networks, but did not say "Device not ready". The third time I booted, the Internet icon does not show at all. I am conjecturing that this is a driver / hardware issue, but don't have enough experience to know. My question is: **What is the next troubleshooting step (if any) based on the steps I have already taken?** **Background Info:**   * The hardware Wi-Fi button is in the on position :-) but the indicator light is not toggling with the button. i.e., when I have the wireless device in the on position while running Windows, the light is blue. When it's off, the light is orange. In Ubuntu, it is showing orange in both positions.    * When I log on to the system, I get a dialog box that says something like, 'The configuration defaults for GNOME Power Manager have not been installed correctly, etc.' (I don't know how this affects the process, but hopefully you do :-)  * * * **Summary of troubleshooting steps (with outputs listed far below):**   1. Stepped through the pertinent troubleshooting steps at the Ubuntu Community Documentation a. Checked for device recognition with `sudo lshw -C network` (output below) b. Checked for a connection to the router with `iwconfig` (output below) c. Checked ip assignment with `ifconfig` (output below)   2. Ran the "Hardware Drivers" utility in System-->Administration (it said 'There are no proprietary drivers on this computer')    3. Identified my card and driver with `lspci -vvnn | grep 14e4` (output below)   4. Checked linuxwireless.org to see if the driver is supported (it is)  **What's my next step?** * * * **1.a -- Output from`sudo lshw -C network`**               *-network                          description: Ethernet interface            product: MCP67 Ethernet            vendor: nVidia Corporation            physical id: a            bus info: pci@0000:00:0a.0            logical name: eth0            version: a2            serial: 00:1b:24:d0:dc:21            size: 100MB/s            capacity: 100MB/s            width: 32 bits            clock: 66MHz            capabilities: pm msi ht bus_master cap_list ethernet physical mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation            configuration: autonegotiation=on broadcast=yes driver=forcedeth driverversion=0.64 duplex=full ip=192.168.1.6 latency=0 link=yes maxlatency=20 mingnt=1 multicast=yes port=MII speed=100MB/s            resources: irq:27 memory:f6488000-f6488fff ioport:30f8(size=8) memory:f6489c00-f6489cff memory:f6489800-f648980f       *-network            description: Network controller            product: BCM4311 802.11b/g WLAN            vendor: Broadcom Corporation            physical id: 0            bus info: pci@0000:03:00.0            version: 02            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list            configuration: driver=b43-pci-bridge latency=0            resources: irq:19 memory:f6000000-f6003fff       *-network DISABLED            description: Wireless interface            physical id: 1            logical name: wlan0            serial: 00:1a:73:bb:d7:35            capabilities: ethernet physical wireless            configuration: broadcast=yes multicast=yes wireless=IEEE 802.11bg      **1.b -- Output from`iwconfig`**               lo        no wireless extensions.          eth0      no wireless extensions.          wlan0     IEEE 802.11bg  ESSID:off/any                Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm                 Retry  long limit:7   RTS thr:off   Fragment thr:off               Power Management:off      **1.c -- Output from`ifconfig`**               eth0      Link encap:Ethernet  HWaddr 00:1b:24:d0:dc:21                inet addr:192.168.X.X  Bcast:192.168.X.XXX  Mask:255.255.XXX.X               inet6 addr: fe80::21b:24ff:xxxX:xxXX/XX Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:4966 errors:0 dropped:0 overruns:0 frame:0               TX packets:4068 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:4503525 (4.5 MB)  TX bytes:777899 (777.8 KB)               Interrupt:27 Base address:0x2000          lo        Link encap:Local Loopback                inet addr:127.0.X.X  Mask:255.0.X.X               inet6 addr: ::X/XXX Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:1958 errors:0 dropped:0 overruns:0 frame:0               TX packets:1958 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:117940 (117.9 KB)  TX bytes:117940 (117.9 KB)      **3 -- Output from`lspci -vvnn | grep 14e4`**               03:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11b/g WLAN [14e4:4311] (rev 02)


title: Find a file when you know its checksum?

text: I have the `md5sum` of a file and I don't know where it is on my system. Is there any easy option of `find` to identify a file based on its `md5`? Or do I need to develop a small script ? I'm working on AIX 6 without the GNU tools.


title: Logfiles for non terminating processes

text: I am writing a program that is designed to never terminate, It will also produce large logs (files) of what it is doing. What I would like is for a linux process to periodically (every X minutes (cronjob?)) :   1. Take the current logs from the current log file    2. place them in a separate file (appropriately named) for offline storage / removal   3. Truncate the current logfile so data is not duplicated. All _without data loss or interruption_ to the producing program. So that I end up with a sequence of time delimeted logs Is there a Linux utility or known solution for this ? or should I build this logging functionality into the program ?


title: Can I prevent a file from being created?

text: We have a machine that runs VMware Server. It constantly creates a file called `not_configured` in `/etc/vmware/`, which somehow makes our virtual machines not able to be started. I wondered if there was any reliable way to **prevent this file from ever being created** in the first place. The file itself doesn't contain anything, so I don't want to create and write- protect it. It shouldn't be there in the first place.


title: How to log in to BackTrack Linux?

text: I've installed BackTrack 5 R3, a security testing distro, onto a USB drive, and I can get it to boot up, but I'm stuck in the BusyBox shell. Everybody says "just log in with username `root` and password `toor`, then type `startx` to launch the GUI, but `startx` reports "command not found". I've tried various commands such as "login" and "sh", but no luck. `sudo` is out of the question, too. I suspect that I need to mount the system squashfs somehow, but I can't figure out how I'm supposed to do it. I haven't had much experience with SFS's before.


title: How to run grep with multiple AND patterns?

text: I would like to get the multi pattern match with implicit **AND** between patterns, i.e. equivalent to running several greps in a sequence:               grep pattern1 | grep pattern2 | ...      So how to convert it to something like?               grep pattern1 & pattern2 & pattern3      _I would like to use single grep because I am building arguments dynamically, so everything has to fit in one string. Using filter is system feature, not grep, so it is not an argument for it._ * * * Don't confuse this question with:               grep "pattern1\|pattern2\|..."      This is an **OR** multi pattern match.


title: Why is the terminal case-sensitive?

text: When I do - `CD ..` instead of `cd ..`   it gives me error saying -               CD: command not found      Why is the **terminal** case sensitive when it comes to linux commands? I mean you should be able to execute the command either with "all uppercase" or "all lowercase" characters. I know it is due to some reason, but I am just curious.


title: GNU date epoch +%s vs. now in timestamp phrases with computations including months?

text: I am trying to do date computations in a shell script using gnu date with timestamp phrases and fail to explain these differences. Can someone enlighten me? Is this a bug?               % date -u -d "now"     Fri Aug  2 15:07:16 UTC 2013          % date -u -d "1970-01-01 00:00:00 UTC  + `date +%s` seconds"     Fri Aug  2 15:07:29 UTC 2013          % date -u -d "now -6 months -1 day"     Fri Feb  1 15:07:52 UTC 2013          % date -u -d "1970-01-01 00:00:00 UTC  + `date +%s` seconds -6 months -1 day"     Tue Jan 29 15:08:03 UTC 2013      I expected the last one to mean exactly the same as the the one before since %s is defined as "seconds since 1970-01-01 00:00:00 UTC" in the manpage.


title: Bash Script not deterministic in performing actions

text: I have a bash script which I invoke on system boot (Ubuntu 10.04) "Startup Applications". script:               #!/bin/sh          APP1='/home/ipc-display/development/projects/display-mgmt'     LOG='/home/ipc-display/development/projects/bootLog.txt'          cd $APP1/target/scala-2.10     java -jar display-mgmt-1.0.jar &          # Auto Hide Mouse Pointer     /usr/bin/unclutter &          #Start chrome     sleep 5s     /usr/bin/google-chrome --incognito --app=http://192.168.0.100:9000/welcome &          #Bring Chrome to focus     sleep 5s     /usr/bin/wmctrl -a "http://" &&           #FullScreen Chrome     sleep 3s &&     /usr/bin/xdotool key F11          bash      My HORRENDOUS scripting ability aside, any ideas on why Chrome does not ALWAYS deterministically go to full screen as I expect? I am scratching my head not able to understand why it goes to full screen sometimes but not all the time. As an aside, any enhancements to this script would be greatly appreciated. Thanks.


title: What is the service that's responsible for automounting a USB drive in CentOS 6.4?

text: I know of the legacy Linux way of mounting a USB stick or drive: mount /dev/sdb1 /mnt/ But in some CentOS 6.x installations I saw, you just insert the USB stick and CentOS automagically mounts it, to `/media/<VOLUMENAME>` This auto-sense must be handled by some kind of a daemon/service, right? What is the name of that service and how do I find it using the `/sbin/service` command?


title: utf-8 locale missing on nexenta

text: I need to use utf-8, but "locale -a" produces:               C     POSIX     iso_8859_1      the os is:               SunOS cteraportal 5.11 NexentaOS_134f i86pc i386 i86pc Solaris      Additional info:               root@cteraportal:~# dpkg -l locales     Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend     |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)     ||/ Name           Version        Description     +++-==============-==============-============================================     ii  locales        1:5.11.134-1   Transitional package      How can i add utf-8?


title: Using a specifing gateway for a packet. (CentOS/RHEL)

text: I have just setup a machine which has two NICs, one for private network and the other one for public network which has a real IP assigned to it.               DEVICE=eth0     HWADDR=XXX     TYPE=Ethernet     UUID=XXX     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     IPADDR=172.26.111.131     NETMASK=255.255.255.128     GATEWAY=172.26.111.129      Configuration of eth1 for public network as follows;               DEVICE=eth1     HWADDR=XXX     TYPE=Ethernet     UUID=XXX     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     IPADDR=PUBLIC_IP     NETMASK=255.255.255.248     GATEWAY=PUBLIC_GATEWAY               Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     default         PUBLIC_GATEWAY   0.0.0.0         UG    0      0        0 eth1     PUBLIC_NID      *               255.255.255.248 U     0      0        0 eth1     link-local      *               255.255.0.0     U     1002   0        0 eth0     link-local      *               255.255.0.0     U     1004   0        0 eth1     172.26.111.128  *               255.255.255.128 U     0      0        0 eth0      I am sure this is quite easy to achieve. I have searched about this, but somehow could not get this working. The machine still tries to route private IPs via public gateway. I would appreciate any ideas on this. Where I am wrong at? I am just trying to be able to access 172.26.111.128/25 via eth0.


title: find command and tar

text: find /informatica/dev/SrcFiles* -mtime +7 -and -size +1M -exec tar -cvjf>      So I ran this command and I can't find the file after it was done running (probably because I never named it?). The directory contains thousands of files. Where do I put the name of what I want the `.tar` to be called? Does anybody know where the tar file gets made and put or what it's called after I run it?


title: Cannot ping machine on eth0; Pings fine on wlan0; Centos 6.5 on Dell D610

text: I recently installed Centos 6.5 (32 bit) on an old Dell D610. It has both a lan port and a wifi. When I assign the wifi a static IP, I can use it as a server, connect to it from other machines etc etc... All good. As soon as I connect my lan cable (DHCP), the other laptops start saying "Destination Host unreachable" I tried keeping only the lan cable and disabling wifi. The centos machine is able to connect to the internet, however none of the other machines are able to find it. Based on advice, I have even tried updating my drivers from http://elrepo.org, however nothing seems to have worked... Right now, I have gone back to disabling the wired lan, and am using the wifi with a static IP to get things working, however I would really like to figure out what I am missing.... Being new to the OS, I am not even sure about the best way to go about debugging this issue. Any help would be appreciated..


title: ansi-term no longer works when emacs is run in daemon mode

text: I shell into a remote server to run emacs using ssh. Ever since I started running emacs as a daemon I've been having problems using ansi-term, shell, and eshell. I can run commands in `eshell` fine, but I can't switch back to another buffer or kill the eshell buffer. When I type these commands nothing happens. When I run `shell` I can enter commands but everything shows up on the same line. If I have the screen split text from shell will run into my other window. Repeatedly pressing `Enter` causes my PS1 to be displayed on the same line, rather than a new line. I also cannot kill the shell buffer or exit emacs using `Ctrl`+`x` `Ctrl`+`c`. I have to type `exit` which kills my `ssh` session all together. `ansi-term` is now the least useful as when I start it Emacs freezes. I can't enter any commands including killing emacs all together. Has anyone had these problems before?


title: Ignore files for zsh's completion for SVN

text: I managed to configure `zsh` such that it does not suggest LaTeX temporary files when I use autocompletion for emacs by adding this line to my `~/.zshrc`:               zstyle ':completion:*:*:emacs:*:*files' ignored-patterns '*?.aux' '*?.bbl' \     '*?.blg' '*?.out' '*?.log' '*?.toc' '*?.snm' '*?.nav' '*?.pdf' '*?.bak' '*\~'      Now zsh ignores all LaTeX temporary files when I request completions for `emacs`. How can I achieve the same for `svn add`? So far I have only found out that the completion for `svn` is rather complicated and was even broken for some time. Just exchanging `emacs` in the above example does not work because I need to affect the completion for the `add` parameter of `svn`. Does someone have an idea?


title: How do I reassemble randomly named tar file fragments?

text: I have a client whose sites were migrated to a new server back in 2012, and I am trying to piece together the old archive to retrieve one of the sites that was not moved. I found a set of files in a temp directory on the new host that had 15 files in it, all named "obfw" followed by 6 random characters, and all randomly dated, ranging from 0 bytes to 207MB. They are all archives, and if I append .tar.gz to the end of any of them (aside from the 0 byte one) and open them with the archive manager, they all show that they are archives for a 2GB folder named backup-9.8.2012_13-35-26_p24acata, all from the same date (which is the date that they were migrated). I have tried joining the files together in various orders (alpha, alpha reversed, by apparent dates), and each one dies when I try and extract the resulting archive either with "truncated gzip input" or "gzip compression failed". However, it appears that the different orders that I cat the files together in give varying amounts of the correct data, so it definitely seems like there is at least a chance that they can all be recombined to create a valid archive. Is there a way to read the headers of these fragments to see what order I should put them in?


Why do I get kicked out of a FTP session once I run a command? It seems that once I successfully login into a server is get the following after running a command such as "ls" (I've enclosed the error portion in the "[ERROR]" tags):               allen92@allen92-VirtualBox:~/Videos$ ftp -n ftp.FreeBSD.org     Connected to ftp.FreeBSD.org.     220 beastie.tdk.net FTP server (Version 6.00LS) ready.     ftp> user     (username) anonymous     331 Guest login ok, send your email address as password.     Password:      230 Guest login ok, access restrictions apply.     Remote system type is UNIX.     Using binary mode to transfer files.     ftp> ls     [ERROR]     421 Service not available, remote server has closed connection     [ERROR]     ftp>       This seems to happen on any remote FTP server. Everything works fine when I login onto the local machine and run FTP commands. If in fact the "421" error is a generic error, is there any way to find out the source of the problem? Any leads on this would be appreciated. I haven't been able to find any support on this _particular_ issue. Anybody with an similar problem please share your thoughts. NOTE: I have **VSFTPD** installed.


title: How to verify that package-installed files match originals?

text: Let's say I have an installed, working and up-to-date system, and want to verify that all package-installed files on it are the same as those packaged by the respective package maintainer. In effect, I want _a list of files that are somehow different between what I have installed "now" and what I would get if I were to reinstall using the same set of packages on a blank system._ Short of actually reinstalling and comparing the outcome, **how would I generate such a list of files?** I realize that some differences (configuration files, for example) are to be expected, but that's okay. I'm primarily interested in Debian Wheezy, but a good answer would explore a solution that works with any reasonably modern Linux distribution based around the same package management infrastructure (apt, dpkg and friends).


title: Compare two files with first column and remove duplicate row from 2nd file in shell script

text: I will ask my question with an example. I have 2 files: **File #1:**               118D FC300_R5_TP  FX.B      32775       2112   6       2038   6       2112   0     118E FC300_R5_TP  FX.B      32775       2136   7       2065   6       2136   0     118F FC300_R5_TP  FX.B      32775       2124   6       2064   6       2124   0     1190 FC300_R5_TP  FX.B     819210     814632  99     814609  99     814632   0     1191 FC300_R5_TP  FX.B     819210     104100  13     103714  13     104100   0     1192 FC300_R5_TP  FX.B    1638420    1609476  98    1609402  98    1609476   0     1196 FC300_R5_TP  FX.B    1638420    1638432 100    1638379 100    1638432   0     119A FC300_R5_TP  FX.B    3276840    3271776 100    3271698 100    3271776   0     119E FC300_R5_TP  FX.B    3276840    3264120 100    3264034 100    3264120   0     11A2 FC300_R5_TP  FX.B    3276840    2328648  71    2328546  71    2328648   0     11A6 FC300_R5_TP  FX.B    3276840    2328444  71    2328355  71    2328444   0     11AA FC300_R5_TP  FX.B    3276840    2328528  71    2328403  71    2328528   0     11AE FC300_R5_TP  FX.B    3276840    2328648  71    2328468  71    2328648   0     11B2 FC300_R5_TP  FX.B    3276840    2130000  65    2129766  65    2130000   0     173A FC300_R5_TP  FX.B    6553680    6478572  99    6477747  99    6478572   0      **File #2:**               11AA FC300_R5_TP  FX.B    3276840    2328528  71    2328403  71    2328528   0     11AE FC300_R5_TP  FX.B    3276840    2328648  71    2328468  71    2328648   0     11B2 FC300_R5_TP  FX.B    3276840    2130000  65    2129766  65    2130000   0     173A FC300_R5_TP  FX.B    6553680    6478572  99    6477747  99    6478572   0     0BDB FC600_R5_TP  FX.B   33554640    6044364  18    6033105  18    6044364   0     0BDC FC600_R5_TP  FX.B   33554640    6613536  20    6481974  19    6613536   0     0BDD FC600_R5_TP  FX.B   33554640    4435848  13    4057170  12    4435848   0     0BDE FC600_R5_TP  FX.B   33554640    6620868  20    6249518  19    6620868   0      ### Desired Output **File #3:**               0BDB FC600_R5_TP  FX.B   33554640    6044364  18    6033105  18    6044364   0     0BDC FC600_R5_TP  FX.B   33554640    6613536  20    6481974  19    6613536   0     0BDD FC600_R5_TP  FX.B   33554640    4435848  13    4057170  12    4435848   0     0BDE FC600_R5_TP  FX.B   33554640    6620868  20    6249518  19    6620868   0      I'd like to compare file 1 and file 2 using their first columns and remove the entire line or row from file 2 where they match in file 1. I'd also like to save the results to a 3rd file, file #3.


title: Debian Server - Autostart two Servers in one Screen Session

text: I want to run a private Minecraft and Teamspeak server on my little vServer. When I start all manually, it works quite well but I want my servers to start automatically on server startup. As I run two servers, I use screen to get multiple windows. But I don't know, how I can start a screen session with two windows and execute one server in each window with a single script, running at startup. Isn't there any possibility to start a detached screen session, send a command to execute to it, open a new window in that session and send another command to it? I thought of something like this:               screen -dmS test -t win1              # create new screen session, name it test                                            #    and name the first window win1     screen -S test -X mcStart.sh          # start the minecraft server     screen -S test -X screen -t win2      # create a new window, name it win2     screen -S test -X tsStart.sh          # start teamspeak server      This doesn't sound bad in my opinion but it simply doesn't work... All I get is a screen session with two empty windows, named "win1" and "win2". Please tell me what I have to do, to get this thing to work. And by the way: If it is possible, I don't want to run each server in a single screen session.


title: How to disable wifi and bluetooth keyboard switches in GNOME?

text: My (capacitive) media keys have recently become autonomous, causing my wifi to switch on and off at random intervals and effectively rendering the machine unusable. How can I disable those keys? My preferred solution is to simply disable or misconfigure the daemon that intercepts the XF86WLAN and XF86Bluetooth keyboard events. I can't seem to figure out though which daemon is currently responsible for this, so some help is appreciated. I'm running Debian Wheezy with a default GNOME 3 setup.


title: How to forward a window (display) to another computer on the network

text: I'm setting up a media server for my movies. The server is networked and so are a couple laptops/desktops. The server is running the latest Ubuntu (desktop edition, not server). This is the scenario I'm trying to achieve:   * Server is turned on and is connected to the network   * Client (my laptop) opens a web interface to the server (or just sends it a command via ssh). I select the movie I want via the web interface, and my interface executes a command.   * The command spawns an instance of VLC with the specified movie playing and forwards the window (just the window) to the computer which requested it.   * End result: I have a VLC window on my laptop which plays the movie for me. I can close it when I'm done. Is it at all possible to forward just a window to a client on the network like that?


title: How to make files inside TMPFS more likely to swap

text: I'm using tmpfs for my `/tmp` directory. How can I make the computer decide to swap out the files inside the `/tmp` before swapping out anything that is being used by applications? Basically the files inside `/tmp` should have a higher swappiness compared to the memory being used by processes. It seems this answer http://unix.stackexchange.com/a/90337/56970 makes a lot of sense, but you can't change swappiness for a single directory. I know about cgroups though, but I don't see any way of making tmp into a cgroup?


title: Device is Mounting as Read Only (Can Copy Files as Root)

text: I am attempting to mount my Amazon Kindle, 3rd Edition. It automounts correctly and when I run `mount -l`, I get the following output:               /dev/sdg1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime) [Kindle]      From this output, it appears to me that I should be able to read and write to the file system. Unfortunately, when I try to copy any files to the Kindle, I cannot do it as a regular user. I do have pmount setup on my machine, so I'm not sure if that is causing the problem...haven't been able to find any additional information about it in regards to this kind of issue. Anybody have any suggestions of what I may be missing here? Thank you. **Updated per Question in Comments**               jascav@home:~$ id     uid=1000(jascav) gid=1000(jascav) groups=1000(jascav),4(adm),7(lp),24(cdrom),27(sudo),29(audio),30(dip),46(plugdev),104(fuse),108(lpadmin),109(sambashare),1001(power)          jascav@home:~$ ls -ld /media/usb0/     drwxr-xr-x 7 root root 8192 Dec 31  1969 /media/usb0/      **Updated per Additional Discussion** I am using usbmount for my automounting solution. I use pmount so a normal user can mount the device. It appears (after further investigation) that these applications aren't working together. usbmount is doing the automounting, but it is not doing it from the user's perspective. If I pumount the device and then mount it again manually, I can write to the device. Getting closer, but I'm still not sure how to get usbmount to honor the user. (Maybe I can't?)


title: git diff displays colors incorrectly

text: In order to get coloured output from all git commands, I set the following:               git config --global color.ui true      However, this produces an output like this for `git diff`, `git log` ![git diff screenshot](http://i.stack.imgur.com/ZWmbt.png) whereas commands like `git status` display fine ![git status screenshot](http://i.stack.imgur.com/iekDY.png) Why is it not recognizing the escaped color codes in only some of the commands and how can I fix it? I'm using iTerm 2 (terminal type `xterm-256color`) on OS X 10.8.2 and zsh as my shell               zsh --version     zsh 5.0.0 (x86_64-apple-darwin12.0.0)          git --version                                                                                git version 1.7.9.6 (Apple Git-31.1)


title: How can i fix the following gmp library dependency error while trying to install Charm?

text: I am trying to install Charm crypto python framework in ubuntu 11.04 with python 2.7. Requirements say that i should have gmp installed 5.*. I have successfully installed gmp lib and i have run all the tests. Also after running `               ldconfig -p |grep libgmp          libgmpxx.so.4 (libc6,x86-64) => /usr/lib/libgmpxx.so.4     libgmpxx.so (libc6,x86-64) => /usr/lib/libgmpxx.so     libgmp.so.10 (libc6,x86-64) => /usr/local/lib/libgmp.so.10     libgmp.so.3 (libc6,x86-64) => /usr/lib/libgmp.so.3     libgmp.so (libc6,x86-64) => /usr/local/lib/libgmp.so     libgmp.so (libc6,x86-64) => /usr/lib/libgmp.so      In order to install Charm i have downloaded it from here. I run `./configure, make , make install`, and `sdconfig` as the INSTALL says. But after running make test for i am getting a lot of errors of this form:               charm/Charm-Crypto-0.43/charm/core/math/integer.so: undefined symbol: __gmpz_powm_sec      Charm shared libraries cannot find libgmp. How can i fix that? I made an ldd integer.so and it uses libgmp.so.3. In my system libgmp.so.3 is placed under /usr/lib so added this line under te config.mk file of the Charm framework:               LDFLAGS= -m64 -L/usr/lib .       (-m64 was already there). I `make` and `make install` again but i am getting the same error


title: Best flavor of Linux for an Acer Revo 3600 as media server?

text: I would like to try Linux on my Acer Revo 3600 (ION) in the hopes that it will perform better than Windows 7, which is extremely sluggish. "All" I need it to do is:   1. Run Plex Media Server   2. Run uTorrent   3. Run LogMeIn (or VNC if necessary)   4. Be able to connect to my network over WiFi (with dongle)   5. Be able to mount SMB shares on the network   6. Support HDMI Video & Audio output   7. Support the Revo's hardware accelerated HD playback I want an "easy" installation -- I am no Linux expert -- but something that is lean and will run smoothly.


title: How can I force the IP address & hostname to only be exposed as domain.com on a Tomcat Server?

text: I have a web server which is running on CentOS 6 on top of Tomcat7. Everything works fine, however, there are many ways that users can access the server. For instance:   * IP Address   * domain.com   * www.domain.com These addresses are all accessible via a browser. However I'd like to configure the server so that when IP address or www.domain.com is accessed, it would point to domain.com. > Example   > IP Address, xxx.xx.xx.xx ► domain.com   > www.domain.com ► domain.com What is the easiest way to achieve this? Is DNS required to configure this on server?


title: Bash overwrites the first line, PS1 bash prompt

text: I have played around with PS1 and PROMPT_COMMAND in bash to create a zsh-style right side prompt. I have a solution who _almost_ works. The problem is that if I write a long line of input, the second line overwrites the first one. The third line will appear nicely on a new line. Maybe some line counter are of-by-one because my cursor movement, or is this a limitation/bug? A simple example:               export PS1="prompt>\[\033[s\033[10C\]test\[\033[u\]"      Print `prompt>`, save position, move 10 characters to the left, print `test`, restore position. The prompts looks nice and works perfectly, until i write more then one line of text. Example 1, expected behaviour:               ------------------------------------     prompt>          test     prompt>ls        test     files...     prompt>1 2 3 4 5 6 7 8 9 10 11 12 13     14 15 16 17 18 19 20 21 22 23 24 25     26 27 28      Example 2, current behaviour:               ------------------------------------     prompt>          test     prompt>ls        test     files...     14 15 16 17 18 19 20 21 22 23 24 253     26 27 28


title: `mpirun -np N`: what if `N` is larger than my physical cores?

text: Say I have a 4-core workstation, what would Linux (Ubuntu) do if I execute               mpirun -np 9 XXX        1. Will 9 run immediately together, or they will run 4 after 4?   2. I suppose that using 9 is not good, because the remainder 1 will make the computer confused, (I don't know is it going to be confused at all, or the "head" of the computer will decide which core among the 4 cores will be used?) Or it will be randomly picked. Who decide which one core to call?   3. If I feel my cpu is not bad and my ram is okay and large enough, and my case is not very big. Is it a good idea in order to fully use my cpu and ram, that I do `mpirun -np 8 XXX`, or even `mpirun -np 12 XXX`.


title: Recursively list files with file names, folder names and permission in CentOS

text: Is there anyway I can list files by typing a command in the shell which lists all the file names, folder names and their permissions in CentOS?


title: bash terminal [\t] (time) is not same timezone as 'date'

text: In my .bashrc file I configured how I would like my prompt to be displayed. My .bashrc is sourced in .bash_profile. The command in the .bashrc file is:               PS1='[\t] \u@\h is $PWD :: '      I switched the user (for me) timezone to GMT+0 using tzselect. The problem I am having is that using the date command I am getting the GMT time (which I am pleased with) but the terminal prompt is still on the system time (even after logging in and logging out), which I am not pleased with. How can I get the terminal to display the time in the time format that I, the user, am specifying?


title: Ubuntu software-center problem in Linux Mint

text: I am using Linux Mint KDE Nadia 14 64bit version. When I run software-center, it dosen't work, following errors appear:               huseyin@huseyin-GA-MA770-UD3 ~ $ software-center     2013-03-31 23:00:24,688 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'     2013-03-31 23:00:24,697 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True          2013-03-31 23:00:25,270 - softwarecenter.region - WARNING - failed to use geoclue: 'org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Geoclue.Master was not provided by any .service files'     2013-03-31 23:00:25,521 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file     2013-03-31 23:00:25,531 - softwarecenter.fixme - WARNING - logs to the root logger: '('/usr/lib/python2.7/dist-packages/gi/importer.py', 51, 'find_module')'     2013-03-31 23:00:25,531 - root - ERROR - Could not find any typelib for LaunchpadIntegration     2013-03-31 23:00:25,628 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None.     2013-03-31 23:00:25,631 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()          (software-center:5515): Gtk-CRITICAL **: gtk_widget_get_toplevel: assertion `GTK_IS_WIDGET (widget)' failed     Traceback (most recent call last):       File "/usr/bin/software-center", line 182, in <module>         app.run(args)       File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1387, in run         self.show_available_packages(args)       File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1325, in show_available_packages         self.view_manager.set_active_view(ViewPages.AVAILABLE)       File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 151, in set_active_view         view_widget.init_view()       File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 139, in init_view         SoftwarePane.init_view(self)       File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/softwarepane.py", line 138, in init_view         self.icons, self.show_ratings)       File "/usr/share/software-center/softwarecenter/ui/gtk3/views/appview.py", line 70, in __init__         self.helper = AppPropertiesHelper(db, cache, icons)       File "/usr/share/software-center/softwarecenter/ui/gtk3/models/appstore2.py", line 108, in __init__         self.all_categories = cat_parser.parse_applications_menu()       File "/usr/share/software-center/softwarecenter/db/categories.py", line 277, in parse_applications_menu         category = self._parse_menu_tag(child)       File "/usr/share/software-center/softwarecenter/db/categories.py", line 471, in _parse_menu_tag         query = self._parse_include_tag(element)       File "/usr/share/software-center/softwarecenter/db/categories.py", line 429, in _parse_include_tag         xapian.Query.OP_AND)       File "/usr/share/software-center/softwarecenter/db/categories.py", line 366, in _parse_and_or_not_tag         operator_elem, xapian.Query(), xapian.Query.OP_OR)       File "/usr/share/software-center/softwarecenter/db/categories.py", line 412, in _parse_and_or_not_tag         q = self.db.xapian_parser.parse_query(s,       File "/usr/share/software-center/softwarecenter/db/database.py", line 185, in xapian_parser         xapian_parser = self._get_new_xapian_parser()       File "/usr/share/software-center/softwarecenter/db/database.py", line 211, in _get_new_xapian_parser         xapian_parser.set_database(self.xapiandb)       File "/usr/share/software-center/softwarecenter/db/database.py", line 177, in xapiandb         self._db_per_thread[thread_name] = self._get_new_xapiandb()       File "/usr/share/software-center/softwarecenter/db/database.py", line 190, in _get_new_xapiandb         xapiandb = xapian.Database(self._db_pathname)       File "/usr/lib/python2.7/dist-packages/xapian/__init__.py", line 3666, in __init__         _xapian.Database_swiginit(self,_xapian.new_Database(*args))     xapian.DatabaseOpeningError: Couldn't stat '/var/cache/software-center/xapian' (No such file or directory)


title: Install Gnome-Shell theme without gnome-tweak-tool?

text: I've just installed fedora 17 and `gnome-tweak-tool`, but it crashes everytime and I can't change the theme. Any other way to do that?


title: Why doesn't Linux use the IANA Ephemeral port range?

text: According to Wikipedia > The Internet Assigned Numbers Authority (IANA) suggests the range 49152 to > 65535 for dynamic or private ports. Many Linux kernels use the port range > 32768 to 61000. Even though there seems to be some historical deviation from IANA's suggested range, it seems awkward that Windows Vista, Windows 7, Windows Server 2008, FreeBSD 4.6+ and many others all have agreed upon this range and yet Linux still stands out. Looking into it though, low and behold:               $ cat /proc/sys/net/ipv4/ip_local_port_range      32768   61000      Why hasn't Linux adopted the standard range?


title: Regular expression problem(s) in Bash: [^negate] doesn't seem to work

text: When I execute `ls /directory | grep '[^term]'` in Bash I get a regular listing, as if the `grep` command is ignored somehow. I tried the same thing with `egrep`, I tried to use it with double and single quotes, but to no better results. When I try `ls /directory | grep '^[term]` I get all entries beginning with term - as expected. I have tried out this command in an online editor, where I can test my regex and it worked as it should. But not in Bash. So it works in a simulation, but not in real life. I work on Crunchbang Linux 10. I hope this is enough information and am looking forward to every hint, because failing to execute on such a basic level and wasting hours of time is really frustrating!


title: Merge chunks from multiple files

text: I need to merge chunks from a few but large files. Each line contains the file name and byte offsets.               # file  begin   end      foo/a   11970   12010     foo/a   22995   23035     foo/b   45090   45130     foo/b   46035   46075     foo/b   48150   48190     foo/c   16200   16240     foo/c   17550   17590     foo/c   18540   18580     foo/c   26730   26770     foo/c   34245   34285      The extraction could use `tail -c` and `head -c`, but this would reopen the same file many times, slowing down the process. The unique solution I thought of was coding a program that seeked to the beginning of each chunk and printed until the end, opening each file only once. Do you have any suggestion?


title: Advantages to uploading files to /tmp before moving off to permanent storage?

text: It seems the common trend in programming when building functionality for handling file uploads is to have the file first uploaded to a temporary directory/folder (e.g. /tmp on Linux). Once the file is completed, it is moved out of the temporary directory and placed in the specified directory for storage. Some programming/scripting languages default to having uploads in progress be placed in /tmp, while others don't, yet it seems common practice to explicitly set /tmp as a placeholder directory until the upload completes, at which point it is moved to a separate directory. What advantage is there to using a temporary "holding" directory to upload content to before moving the file(s) off to another partition/directory for long term storage? I work in an environment where (in-house) network storage is mounted via NFS mounts to virtual machines for persistent storage of large amounts of data (terabytes). As technology progresses, we're able to ingest data more rapidly, and in much more significant quantities. Several years ago, it was a simple HTTP upload of one file at a time (of relatively small size, megabytes?), then we went to Flash uploads. Now we have drag and drop uploads, even with the potential of uploading a file/folder structure in some browsers, in the realm of gigabytes. It's getting to the point where one user could easily exceed the partition set aside for /tmp if they really want to upload enough at once. What would be the advantage of expanding /tmp versus just having it directly sent off to the file server, aside from network latency through the NFS mount? Is this a legacy (now bad-) practice that has grown outdated now that technology is allowing for us to ingest quantities of data that were otherwise inconceivable a decade ago?


title: Powertop doesn't display Power est. column

text: When I run powertop, it doesn't display the "Power Est." column that shows the estimated power consumption in Watts of each row. It should look like in the screen capture here: MacBook Pro Retina: huge power consumption But it actually looks like this:                         Usage     Device name             100.0%        USB device: Biometric Coprocessor (STMicroelectronics)             100.0%        Display backlight             100.0%        Audio codec hwC0D0: Analog Devices               7.2%        CPU use             67067 pkts/s  Network interface: wlan0 (iwl4965)               0.0 pkts/s  Network interface: eth0 (e1000e)      The "Power Est." column is missing. The total power discharging from the battery is reported, however. From lore on the net, I can find claims that it just needs more measurements before it will report this data, but no official statement or documentation of this fact. I have run `powertop --calibrate` several times, and left it running while on battery for hours now. How can I get this column to display, or how many "measurements" does powertop need before it will display this?               $ powertop --version     PowerTOP versionv2.1, compiled on Aug 23 2012      I'm running Ubuntu 13.04 (raring) on a Lenovo Thinkpad T61p.               $ uname -a     Linux compy 3.8.0-33-generic #48-Ubuntu SMP Wed Oct 23 09:16:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      I tried installing PowerTop 2.4 from source, but it has the same problem.


title: Stopping output from a program run in SSH session NOW

text: ## Problem I execute command that outputs LOTS of information through SSH. For example, I foolishly add debug information inside a loop that executes million times, or just run `cat /dev/urandom` for kicks. The terminal is flooded with information. ![Example what I'm talking about](http://i.stack.imgur.com/Ozwib.gif) I want to terminate the command ASAP and fix my program. I don't care what it prints. Now, the thing is that I press `Ctrl`+`C` ASAP (in the example above I pressed it immediately after running the command), but **it still takes its time to print all the information I don't even need**. ## What I've tried I tried pressing `Ctrl`+`C` so hard that it had funny results when terminal finally caught up:               OUTPUT HERE^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     ^C^C          ^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C      I also read about `Ctrl`+`S` which apparently is used to tell terminal "stop output, I need to catch up" but apparently it does nothing. ## Miscellaneous details I'd like not to alter the command I run so I can rescue myself in any situation, even if I don't remember that the program I run could end up like that. My SSH client runs on Cygwin (`CYGWIN_NT-6.1-WOW64 luna 1.7.30(0.272/5/3) 2014-05-23 10:36 i686 Cygwin`) in MinTTY with terminal type set to `xterm-256color`. SSH server runs on Debian (`Linux burza 3.2.0-4-686-pae #1 SMP Debian 3.2.51-1 i686 i686 i686 GNU/Linux`).


title: applications that would benefit having a 64bit Os on a 64bit cpu with maximum of 4gb ram

text: I am trying to find out for which kind of applications (cpu intensive, io intensive, good mix of cpu/io apps) it is worth putting a 64 bit Os on 64 bit hardware instead of a 32 bit os where the Ram cannot be extended more than 4GB?


title: Reliable External Wifi adapter for Backtrack

text: Im thinking about getting this adapter for backtrack http://www.amazon.com/Alfa-AWUS036H-Wireless-Long-Rang- Panel/dp/B003YI4HRM/ref=sr_1_3?ie=UTF8&qid=1330456917&sr=8-3 Because it supports packet injection. Do you guys recommend a better adapter and why? Thanks


title: Edit and recompile individual program

text: whereis pwd     pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz      The pwd in the binary folder is not the same as               type pwd     pwd is a shell builtin      so wouldn't it be harmless to do some experimentation on the external pwd? Like, adding a "Hello shell!" cout just to demonstrate the principle? Where is the source for pwd? Do you usually get it with the distribution (I'm on Debian) or do you somehow install or download it? Is it in C? Do I compile it like any other file with gcc and put the result (with fitting chmod) in a folder encompassed by the path? What about upgrades? As you understand, I'm missing the big picture here. (By the way, the header file seems to be unrelated: pwd as in password, not print/present working directory.)


title: dd copies more data than exists in .img?

text: I'm trying to dd an .img file over to my micro sd (8 GB). The rom (.img) is 2.66 GB, but in my output of DD (live) it says its transfered **9 GB**. I don't get how it's turning a 2 GB image into 9 GB. I'm running OSX Lion and using a Belkin card read. The card reader is not the problem, I have used disk utility with it with no problem. I think the problem is dd or my card (I hope it's not my card :( ). EDIT:Here is the command I use to copy the file               dd if=honey.img of=/dev/disk1 bs=1m      This is the code I use to check the status:               killall -INFO dd


title: xfce4 netload plugin, monitor on all interfaces?

text: Is it possible to monitor all interfaces with xfce4's netload plugin? Currently I can only place one interface name on it.


title: amd64 or i386? VirtualBox can't start client VM

text: My Debian kernel is `linux-image-2.6.32-5-amd64`, and the command `uname -m` returns `x86_64`. However, `apt-get` does get i386 packages (those `/var/cache/apt/archives/*_i386.deb`), and never gets amd64 package. I want to install virtualbox, but neither `-i386` nor `-amd64` work for me. I have tried to install `virtualbox-4.1-amd64.deb`, but it was said the version incorrect, then, I can only install `virtualbox-4.1-i386.deb`. But after installed `-i386`, virtualbox couldn't launch the client VM, system mismatch error. I'm confused what the true arch type my system indeed is, i386? amd64? or x86_64?


title: How to start the Snort service with logging enabled?

text: I setup snort on Centos server and add as a service. When I use `service snortd start` command, the log file is created but it is empty. If I use `snort -q -l /var/log/snort` command, the log file created and filled with logs. What should I do in order to use `service snortd start` and have the logs work?


title: Loop through tab delineated file in bash script

text: Here's what I have so far:               #!/bin/bash     while read line; do             DB=$(echo $line | cut -f1)             USER=$(echo $line | cut -f2)             PASS=$(echo $line | cut -f3)             echo DB=$DB USER=$USER PASS=$PASS     done < users.txt      And a sample of the input file:               drupal_1    drupal1 tmmjXSWL     drupal_2    drupal2 FHiJSYHM     drupal_3    drupal3 b7bFNj06     drupal_4    drupal4 0AaV62EL      And output from the script:               DB=drupal_1 drupal1 tmmjXSWL USER=drupal_1 drupal1 tmmjXSWL PASS=drupal_1 drupal1 tmmjXSWL     DB=drupal_2 drupal2 FHiJSYHM USER=drupal_2 drupal2 FHiJSYHM PASS=drupal_2 drupal2 FHiJSYHM     DB=drupal_3 drupal3 b7bFNj06 USER=drupal_3 drupal3 b7bFNj06 PASS=drupal_3 drupal3 b7bFNj06      For some reason, each variable is set to the whole line. When I use `echo users.txt | cut -f1` at the command line, it returns the token just fine.


title: How to make vnc server and ldap authentication work together?

text: I have a RHEL 6.4 box and I am running `tigervnc-server` on the box to enable remote gui access for different users. I have the users created locally and have created separate displays for them in the `/etc/sysconfig/vncservers` file, as well as `vncpasswds` in their home directories. Now I'm thinking about moving the users to OpenLDAP and configuring `sshd` to authenticate via LDAP with the user home directories moved to a common NFS share. So with LDAP authentication in place, am I supposed to separately create displays and `vncpasswd` in the home directory for every new user added to the LDAP database? Is there some way to automatically create a display for a new user who logs in and have the vncserver authenticate against the LDAP directory ? Do I need a different VNC server?


title: Arch Linux run script a minute after boot

text: I have set up a bridge between eth0 and wlan0 with netctl. It works fine if I tell it to configure eth0 and wlan0 at startup and then for me to manually start the bridge after it boots. If I tell the bridge to start automatically as well though for some reason the wlan adapter does not connect to an access point. I therefore need "netctl start bridge" to run a minute or so after the entire system has finished booting. Any idea how I should do this? PS. This is a headless system as in no xorg so running it at xorg startup won't work.


title: How to get access to the root journal for systemd?

text: When I execute `journalctl -f -a` under Fedora 20 for different users I get different results. For root I get something similar to `tail -f /var/log/syslog` on older systems. As normal user I get gnome-shell warnings, some su messages, stuff Firefox writes to stdout etc. - basically a user session log. I understand that journalctl has the concept of different journals (journalctl(1)): > Output is interleaved from all accessible journal files, whether they are > rotated or currently being written, and regardless of whether they belong to > the system itself or are accessible user journals. But how to get list which journals are available for a given user? And how to give a normal user also access to the root journal? The journalctl man page states: > All users are granted access to their private per-user journals. However, by > default, only root and users who are members of the "systemd-journal" group > get access to the system journal and the journals of other users. But this sounds like too much - the user should not have access to the journals of other normal users (just to the root journal).


title: How can I pass a whitespace-delimited values file as a series of arguments?

text: Say that I have a file with a list of packages I want to install, separated by spaces or newlines. How can I pass that file to my package manager?


title: changing xorg driver for netbook with cedarview integrated graphics

text: So I was messing around. I installed debian, everything worked fine. I had to re-install debian for whatever reason. It decided to do something different and now I'm stuck with a 800x600 resolution (display settings don't allow me to go above). I think my problem is similar to this one: http://crunchbanglinux.org/forums/topic/18658/eeepc-intel-cedarview- resolution/ because I'm pretty sure that it's using the VESA driver. Now I'm hoping I can change VESA to the appropriate intel driver. My questions are:   1. how would I change to using the appropriate intel graphics driver (gma3600) ?   2. would changing this driver require reinstalling the operating system? (there was talk of this in the thread I linked to). Or which kernel do I need to have? Part of the reason why I'm asking is because this seems to require a lot of sensitive configuration and I don't want to spend the next couple of hours (days) troubleshooting. If it makes any difference the processor is an intel atom N2600.


title: Keeps on getting message files are identical using find

text: Whenever I enter this:               find . -type f -name 'diag*' -mtime +30 -exec mv {} temp_diag \;      in SunOS I always get this message               mv: ./temp_diag/diagnostic.log.68.gz and temp_diag/diagnostic.log.68.gz are identical     mv: ./temp_diag/diagnostic.log.37.gz and temp_diag/diagnostic.log.37.gz are identical     mv: ./temp_diag/diagnostic.log.18.gz and temp_diag/diagnostic.log.18.gz are identical      The command I used just works fine but am just concerned with what the messages mean.


title: grep for all the lines that doest not have a particular word

text: I have a file fileA.txt               Batman.plist     Green Arrow.plist     Hawkgirl.plist     EOPrototypes.plist     Person.plist     EOPrototypes.plist     EOJavellinPrototypes.plist     Sinestro     Slomon Grundy.plist     Batman Beyond.plist     EORedRobin     EORavenPrototypes.plist      Now if I want to get all the lines that end with `plist` and does not contain the word `Prototype`. So far I have               grep -v "Prototype" fileA.txt | grep -E "*plist$"      And the output is               Batman.plist     Green Arrow.plist     Hawkgirl.plist     Person.plist     Slomon Grundy.plist     Batman Beyond.plist      Which is exactly what I want, But is there a better way to do this?


title: How to limit MAX an MIN length of a string?

text: "nothing" means no OUTPUT. **Q:** how can I limit the MIN and MAX length of a piped **STRING**? (MIN: x>=3 chars, MAX: x<=32 chars) INPUT:               echo 12 | MAGIC      OUTPUT:               nothing      * * * INPUT:               echo 123 | MAGIC      OUTPUT:               123      * * * INPUT:               echo 123456789012345678901234567890123 | MAGIC      OUTPUT:               nothing      * * * INPUT:               echo 12345678901234567890123456789012 | MAGIC      OUTPUT:               12345678901234567890123456789012