Mounting an MTP enabled device on Ubuntu 12.04.3 LTS 32-bit

My aim is to perform file operations on my Samsung Galaxy Note 10.1 (older edition) using Ubuntu 12.04.3 LTS 32-bit. This does not work out of the box as I plugged my device and saw myself. In order to mount and have the device recognized by the OS I tried various tutorials on the net. I summarize them as follows: **Mounting your MTP Android’s SD Card on Ubuntu**               http://www.mysolutions.it/mounting-your-mtp-androids-sd-card-on-ubuntu/?replytocom=5183#respond      I have done everything as described but when I run "mtp-detect" command the following output is generated:               mtp-detect     Unable to open ~/.mtpz-data for reading, MTPZ disabled.libmtp version: 1.1.6          Listing raw device(s)     Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).        Found 1 device(s):        Samsung: Galaxy models (MTP) (04e8:6860) @ bus 3, dev 2     Attempting to connect device(s)     PTP_ERROR_IO: failed to open session, trying again after resetting USB interface     LIBMTP libusb: Attempt to reset device     inep: usb_get_endpoint_status(): Invalid argument     outep: usb_get_endpoint_status(): Device or resource busy     usb_clear_halt() on IN endpoint: Device or resource busy     usb_clear_halt() on OUT endpoint: Device or resource busy     usb_clear_halt() on INTERRUPT endpoint: Device or resource busy     LIBMTP PANIC: failed to open session on second attempt     Unable to open raw device 0     OK.      **Adding the GVFS-mtp PPA available on Launchpad** https://launchpad.net/~langdalepl/+archive/gvfs-mtp This worked and initially it auto mounted the tablet upon plugging it in. However, I cannot perform file operations on the tablet such as opening a file (say pdf) residing inside the memory of the tablet, copying a file inside the memory of the tablet to another place in the memory of the tablet; the same goes for moving. This solution was described in this post: http://askubuntu.com/questions/87667/getting-mtp-enabled-devices-to-work-with- ubuntu/308366#308366 **Using go-mtpfs** I tried this by following the instructions on the following website: http://www.webupd8.org/2012/12/how-to-mount-android-40-ubuntu-go-mtpfs.html The output of trying to mount the device is as follows:               go-mtpfs /media/MyAndroid/     2014/04/21 19:43:24 compiled against libmtp 1.1.5     Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).     2014/04/21 19:43:24 found device Samsung: Galaxy models (MTP) (04e8:6860) @ bus 3, dev 2     :      PTP_ERROR_IO: failed to open session, trying again after resetting USB interface     LIBMTP libusb: Attempt to reset device     inep: usb_get_endpoint_status(): Invalid argument     outep: usb_get_endpoint_status(): Device or resource busy     usb_clear_halt() on IN endpoint: Device or resource busy     usb_clear_halt() on OUT endpoint: Device or resource busy     usb_clear_halt() on INTERRUPT endpoint: Device or resource busy     LIBMTP PANIC: failed to open session on second attempt     2014/04/21 19:44:00 rdev.open failed: open: open returned nil      I also wonder if the screen lock really interferes with these sort of operations. Note that I got the above results without the screen lock active. I also added a screenshot from Nautilus showing that the device is detected upon linking but not mounted automatically. I suspect that some of these options may have caused some sort of clash and I would be very grateful if you can provide assistance on mounting my device properly and performing file operations both within the tablet, and between the tablet and the laptop. Thanks in advance, ![enter image description here](http://i.stack.imgur.com/Z9mUF.png)


grep --color adds ANSI code ESC[K - This can change displayed text

Why does grep add ANSI code `\e[K` to its colored output? I can't see the point of it, but obviously the developers can. It is an ANSI/VT100 Terminal code which is used to _"Clear line from current cursor position to end of line"_. In a fringe case, grep can cause text to "vanish" from the terminal display. For example:               echo -e "ab\rc"     echo -e "ab\rc" |grep --color=always "c"      The simple _echo_ displays: `cb`, but the _colorized_ display shows: `c` The underlying encoded text is: `echo -e 'ab\r\033[01;31m\033[Kc\033[m\033[K'` However, without the `\e[K` codes, `echo -e 'ab\r\033[01;31mc\033[m'` works as expected! What is the reason for grep's inclusion of these `\e[K` codes. I'm writing a script to allow for overlaying of a second colorizing pass, as in: `c=--color=always; ls $c /bin/gzip | grep $c 'z'`. so I need to _understand_ why grep uses `\e[K`.


Is here an editor for linux terminal like there is for MS-DOS?

I know that there is an editor built into MS-DOS, so you can create batch (.bat) files. But is there something like that for Linux Mint 12 terminal?


List files larger than {size} sorted by date

I want to solve the problem 'list the top 10 most recent files in the current directory over 20MB'. With `ls` I can do:               ls -Shal |head      to get top 10 largest files, and:               ls -halt |head      to get top 10 most recent files With find I can do:               find . -size +20M      To list all files over 20MB in the current directory (and subdirectories, which I don't want). Is there any way to list the top ten most recent files over a certain size, preferably using `ls`?


How do I install the latest version of Chromium in Debian Squeeze?

I know that Debian Squeeze has Chromium 6.x only. So I added backports but seems that Chromium is not included. Since Chromium/Chrome development is very fast, version 6.x has sort of become outdated. Is there a way to install the latest version of Chromium to Debian Squeeze without changing the system from stable to testing/unstable?


xterm doesn't switch directory when it is moved

Recently I was very frustrated with xterm not behaving as expected. This is what I was doing:   1. open xterm   2. run the following commands:              $ mkdir test_01     $ cd test_01/     $ echo 'a' > a     $ cat a      The output will be:              a        3. open another xterm (don't close the first one)   4. run the following commands:              $ mv test_01/ test_01_old     $ mkdir test_01     $ cd test_01     $ echo 'b' > a     $ cat a      The output will be:              b        5. now in the original xterm run the command:              $ cat a      The output will be:              a      **Why does this happen?** At this stage, both xterms report the same directory with the `pwd` command (which is `/home/user_1/test_01`).


UUID based on global MAC address

I used the `uuid` command from the `uuid-1.6.2-8.fc17.x86_64` package to generate version 1 UUIDs. The man page said that the default is to use the real MAC address of the host, but when I decoded the generated UUID, it is using the local multicast address. `uuid v 1` shows:               5fc2d464-e1f8-11e1-9c3d-ff8beec65651      Decoding with `uuid -d 5fc2d464-e1f8-11e1-9c3d-ff8beec65651` shows:               encode: STR:     c7ee12de-e1f7-11e1-99f1-53d638ec6296             SIV:     265752520555487307909286258714002350742     decode: variant: DCE 1.1, ISO/IEC 11578:1996             version: 1 (time and node based)             content: time:  2012-08-09 07:56:52.526563.0 UTC                      clock: 6641 (usually random)                      node:  53:d6:38:ec:62:96 (local multicast)      How can I make it use my actual MAC address, and my time zone (`Asia/Tehran`, not UTC)?


Invert colours on Dual-Screen / Dual-Monitor setup?

In order to invert colours on monitor, I invoke:               xcalib -invert -alter      The problem is, that on Dual-Monitor setup it inverts colors only on first screen. I can not use Compitz gadgets for color inverting, cause my setup is   * Two rotated (pivot) Monitors Dual-Screen when both are Piovot is not working with composing on my card. Xorg seems only solution. xcalib is great cause I can switch depending on app, immediately. Cany suggestions, solutions how to invert colors on both screens with xcalib ? P.S. `-screen` parameter does not work:               X Error of failed request:  BadValue (integer parameter out of range for operation)       Major opcode of failed request:  130 (XFree86-VidModeExtension)       Minor opcode of failed request:  19 (XF86VidModeGetGammaRampSize)       Value in failed request:  0x17       Serial number of failed request:  10       Current serial number in output stream:  10      Here is my `xrandr` screen configuration:               ~$ xrandr                                                                                Screen 0: minimum 320 x 200, current 2400 x 1920, maximum 3840 x 3840                                                                                DFP1 connected 1200x1920+1200+0 left (normal left inverted right x axis y axis) 518mm x 324mm                                                                                1920x1200      60.0*+                                                                                1680x1050      60.0 +                                                                                1440x900       59.9 +                                                                                1280x800       60.0 +                                                                                1920x1080      60.0     50.0     30.0     25.0     24.0                                                                                (...)                                                                                DFP2 connected 1200x1920+0+0 left (normal left inverted right x axis y axis) 518mm x 324mm                                                                                1920x1200      60.0*+                                                                                1920x1080      60.0 +                                                                                1776x1000      60.0 +                                                                                1680x1050      60.0 +                                                                                1440x900       59.9 +                                                                                1280x800       60.0 +   75.0                                                                                1152x648       60.0 +                                                                                1600x1200      60.0                                                                                1400x1050      60.0                                                                                1280x1024      75.0     60.0                                                                                (...)                                                                             CRT1 disconnected (normal left inverted right x axis y axis)                                                                                CRT2 disconnected (normal left inverted right x axis y axis)         As you can see, they are rotated - `1200x1920` setup on one virtual screen with `maximum 3840 x 3840`. I think, that's reason why it's like "one" screen with `2400x1920`, splitted on both (so, xcalib applies only to primary one). But, it's only my hypothesis, maybe reason is different.


How do I resolve an apparent hanging update process

I am trying to update an instance on AWS. I have little familiarity with linux in general. However, I did run the command on my Ras. Pi first and had no problems. However this is the second time the process has hung here. Last time I pressed the enter key, and more lines showed up but eventually I was disconnected and the next time I logged in I was told I had a Zombie process running. I rebooted and tried apt-get upgrade again and still am confronted with this after a bit of time Here is the content               119 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.     Need to get 0 B/77.0 MB of archives.     After this operation, 8,320 kB of additional disk space will be used.     Do you want to continue [Y/n]? Y     E: Version '2.02.66-4ubuntu7.4' for 'libdevmapper1.02.1' was not found     E: Version '2.02.66-4ubuntu7.4' for 'dmsetup' was not found     E: changelog for this version is not (yet) available; try https://launchpad.net/     ubuntu/+source/update-manager/+changelog     E: Version '2.02.66-4ubuntu7.4' for 'libdevmapper-event1.02.1' was not found     Reading changelogs... Done     ca-certificates (20130906) unstable; urgency=low             Update mozilla/certdata.txt to version 1.86           Certificates added (+) (none removed):          + "Actalis Authentication Root CA"          + "Trustis FPS Root CA"          + "StartCom Certification Authority" (renewal/rehash)          + "StartCom Certification Authority G2"          + "Buypass Class 2 Root CA"          + "Buypass Class 3 Root CA"     /tmp/tmpEp5oWU


OpenLdap phpLDAPadmin restrict record deletion OR delegate password reset permissions for IT staff

I would like to restrict `phpLDAPadmin` task such as removing the deletion of a record feature. I tried to look up to figure out if there is any settings or value can be setup to disabled these task but can't seems to find it there.                         /var/www/html/phpldapadmin/config/config.php                    /etc/httpd/conf.d/php.conf      I do see `/var/www/html/phpldapadmin/hooks/functions/example.php` with following delete exanoke but not clear how to apply this.                  /**         * This pre_entry_delete function is called before an entry is deleted in                 ds_ldap_pla::delete().         *         * Arguments available are:         * @param int Server ID of the server to be connected to         * @param string Method. The user connection method, normally 'user'.          * @param string DN of the entry deleted          * @see post_entry_delete          */         function example_pre_entry_delete() {                 $args = func_get_args();                      system_message(array(                         'title'=>sprintf('Hook called [%s]',__METHOD__),                         'body'=>sprintf('Arguments:

Server ID:         %s

Method: %s

DN: %s

',$args[0],$args[1],$args[2]),                         'type'=>'info','special'=>true));                      return true;         }      Update: I found the following code that execute delete a record procedure. if I rename this file then I get page not found error. I could just place php code for access not allowed message there and link to redirect to home page. /var/www/html/phpldapadmin/htdocs/delete.php **Is this is the best way to handle this ?** Basically, I need to setup delegate password reset permissions for IT staff on OpenLDAP?


Lightweight userspace sandboxing of filesystem

I would like to trick a non-malicious process to think that it is writing to directory `$HOME/abc/def/` while it writes in fact to `$HOME/xyz/def` (the former path is hardcoded and it does not work for my for various reasons). The `$HOME/abc/def/` directory should not exists at all. I thought about using user namespace + filesystem name-space to mount a aufs filesystem over it but I failed (the mount finished stating insufficient privileges). Is it possible to do using user + filesystem namespaces? If not is there any risk creating suid program that creates such filesystem namespace for single program (the setup is currently low-security but I prefer to be security concious)? Or maybe there is existing solution to do it?


telnet client - output hexadecimal network traffic on debian

Reading the manpage I thought it should be possible to print incoming characters in hexadecimal. But it didn't work. Do you know what I'm doing wrong? This is the relevant manpage description:               debug           enable Debugging     netdata         enable printing of hexadecimal network data (debugging)     prettydump      enable output of "netdata" to user readable format (debugging)     options         enable viewing of options processing (debugging)     termdata        enable (debugging) toggle printing of hexadecimal terminal data      And this is the telnet session, as you can see only ASCII characters are printed:               telnet> set netdata     Will print hexadecimal representation of network traffic.     telnet> set termdata     Will print hexadecimal representation of terminal traffic.     telnet> set debug     Will turn on socket level debugging.     telnet> open 192.168.128.121 4015     Trying 192.168.128.121...     Connected to 192.168.128.121.     Escape character is '^]'.     ?@?±?@?¦?@?¦?@?±?@?¦?@?±?@?¦^]


What is the difference of kernel/distribution's release and version?

I use the following command to see the name, release and version of a kernel.               -bash-4.1$ uname -s      Linux     -bash-4.1$ uname -r     2.6.32-279.el6.x86_64     -bash-4.1$ uname -v     #1 SMP Wed Jun 13 18:24:36 EDT 2012      What is the difference and relation between kernel's release and version? Thanks! Similar question for a Linux distribution (e.g. Ubuntu, Mint, ...)? I.e. what is the difference and relation between a Linux distribution's release and version?


How to replace a disk in a non-redundant ZFS pool?

I've been doing a bit of reading, and it looks like ZFS doesn't like disks being removed from non-redundant arrays: > You can use the `zpool detach` command to detach a device from a mirrored > storage pool. For example: >   >   >     # zpool detach zeepool c2t1d0 >   > > However, this operation is refused if there are no other valid replicas of > the data. For example: >   >   >     # zpool detach newpool c1t2d0 >     cannot detach c1t2d0: only applicable to mirror and replacing vdevs >   The basic problem is understandable: removing the only copy of a piece of data (whether metadata or payload data) from an array would render that data unavailable. The examples for replacing devices in a ZFS storage pool give a basic step-by- step description for how to replace a device in a storage pool: offline the disk, remove the disk, insert the replacement disk, run `zpool replace` to inform ZFS of the change and online the disk. This obviously requires that the array does not depend on the disk being replaced, hence the array must have redundancy; if it does depend on the drive in question, this approach presents the same problem as above. **What is the recommended way of _replacing_ a disk in a _non-redundant_ ZFS array?** Assume that the existing disk is working properly, and assume that the replacement disk is at least the same size as the disk being replaced. (If the existing disk has failed, clearly all one could do is add a new disk and restore all files affected by the disk failure from backup.)


Changing drives in FTP

I am using RHEL6 and I connect to FileZilla FTP Server in Windows 2008 Server which has more than 10 drives. I have access to all of them but for my user `C:\` is Home Directory. I want to change to other drives, such as `D:\ Y:\ S:\` etc. When I type `lcd d:\` it outputs > no such file or directory How I can change Windows drives with my Linux command-line FTP client (`ftp`)?


While reading from a file, choose specific fields and compare them with another file in Unix bash?

I have a CSV file that contains the columns a,b,c,d and e and another file that contains column z. While reading line by line from the 1st file I want only fields c and d and at the same time I want to compare d with z from the second file. z is a variable meaning, `for i in catfileb do ......`. Now if d is the same as z then display z, but if they are different, then always display "pin". But if z is for example longest or smallest display "lon" or "sma". File a:               a b c d e     1 2 2 3 3     3 4 6 5 9     4 5 0 9 9      File b:               z     3     1     8      So c, d, and z are variables, so I was thinking of two loops. While reading line by line file a, get c and d, then compare with z.


Ubuntu 12.04 hotspot wifi network not visible to Android 4.1.2

I'm running Ubuntu 12.04 LTS on my notebook, and I've got a Motorola Razr which I updated to Android 4.1.2. Before updating, I connected my smartphone to my hotspot wifi very quickly, but after the update it no longer works. Android 4.1.2 can't see the hotspot created by Ubuntu; it sees all other wifi networks and can connect to them, but not mine. What could be wrong?


read -a array -d '\n' < foo, exit code 1

If I try to execute               read -a fooArr -d '\n' < bar      the exit code is 1 -- even though it accomplishes what I want it to; put each line of `bar` in an element of the array `fooArr` (using bash 4.2.37). Can someone explain why this is happening * * * I've found other ways to solve this, like the ones below, so that's not what I'm asking for.               for ((i=1;; i++)); do         read "fooArr$i" || break;     done < bar      or               mapfile -t fooArr < bar


How signals work internally?

In general, to kill processes we generate signals like `SIGKILL`,`SIGTSTP` etc. But how is it known who ordered that particular signal, who has sent it to a particular process, and in general how do signals perform their operations? How do signals internally work? An explanation would be appreciated.


How do I identify why my login hangs for 20 seconds at startup?

I've done something (I can't remember what) and now when I log in, just after entering my details, I see the background with my mouse cursor and nothing happening. Then, after about 20 seconds (presumably a timeout) the hard drive keeps loading and I get my desktop. I tried install `bootchart2`: `apt-get install bootchart2 pybootchartgui` I followed their instructions here and added the following line to `/etc/default/grub`: `initcall_debug printk.time=y quiet init=/sbin/bootchartd ...` when I run update-grub I get the following error message: `/usr/sbin/grub-mkconfig: 12: /etc/default/grub: initcall_debug: not found`


tun0 enabling after installing openvpn

I just installed openvpn but can't see `tun0` when I do `ifconfig`. when I `ssh` to a remote server, I get the error: > debug1: Authentications that can continue: publickey,password How can I enable it?


Settings when using a bridge

I have a bridge set up between my physical Ethernet interface, `eth0`, and the virtual interface for OpenVPN, `tap0`. The bridge has an IP address, and the machine can be contacted on that IP address from either interface. However, I don't know what to configure to get traffic flowing across the bridge, between the interfaces. Is `net.ipv4.ip_forward = 1` necessary to set for bridging, or is it just a setting required for routing? How should I configure the `FORWARD` chain in `iptables`? Ideally only traffic between the interfaces should be forwarded, so that the machine cannot be used as a bounce point within the network.


GNU Screen: new window name change

I can change the name of a window with Ctrl-a Shift-a. Instead of editing several window names by hand, is there a way to have them automatically named after the current directory?


Selecting files that start with $LETTER, or a letter later than $LETTER in the alphabet

Suppose a directory contains the following files:   * afile1   * afile2   * bfile   * cfile   * ffile   * ffile2   * qfile   * zfile I am looking for an easy way of selecting all the files which start with $LETTER, or start with a letter later than $LETTER in the alphabet. A solution that could be easily modified to find files that start with $LETTER or files which start with a letter _earlier_ than $LETTER in the alphabet would be useful. E.g. In the above list, with LETTER=c, I want to select "cfile, ffile, ffile2, qfile, zfile" The above is a simplified example. In the real world the directory will contain several thousand files. In the end I used `ls | tail -n${FUDGE_FACTOR}`, where fudge factor was discovered manually, but am looking for a way to do this automatically. I'm looking for a shell based solution to this (I use BASH, but solutions in other shells are welcome). I'm aware that shell scripts probably aren't the best tool for this task, but am asking purely out of interest (to learn more about shell scripts), so please don't reply with answers in python/perl/lua/$FAVE_SCRIPTING_LANGUAGE General comments on the limitations of shell scripts for this kind of task, and the best way to work around these limitations in reality (i.e. without my "must be a shell based solution" stipulation), would be most welcome. Thanks


How can I configure two mails for two different users in Ubuntu

I am struggling with configuring `two mails for two different users` in Ubuntu. Like if I login with `User1` then whenever I use the command mail, it should send mail from `user1@gmail.com`. And when User2 logins with its credentials then it should send mail from `user2@gmail.com`. Currently I've changed my `/etc/ssmtp/ssmtp.conf` for my Gmail id. But when I send mail from a different user, the same mail id is been used. Can anyone please provide any pointer or links?


Converting dvd to MKV videos, anything wrong here?

I'm converting DVD media to a MKV format video with mencoder: `mencoder dvd://4 -o output.mkv -oac mp3lame -ovc x264 -x264encopts crf=20:8x8dct:frameref=4:bframes=3:b_pyramid=normal:weight_b` But the output from `file output.mkv` indicate it's AVI format ? `RIFF (little-endian) data, AVI, 720 x 576, 25.00 fps, video: H.264 X.264 or H.264, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)`


Extracting only the module and the libraries from the AMD ATI proprietary drivers

I need to use this drivers in a Linux based system that is highly customized and so I'd like to know if there is a way of having this pieces just ready to be manually installed and/or used. In other terms I need the *.so libraries and the kernel module.


Lubuntu display resolution + VirtualBox

Running the most recent Lubuntu 14.04 as a live OS inside virtual box works without any problemes at 1024 x 768 pixels screen resolution. But when I install it, Lubuntu has a low resolution of 620 x 480 or something little like this. If I install VBoxGuestAdditions it is possible to make the screen bigger. But why does this not work out-of-the-box like the live cd? Any ideas how (or which files) to copy the configuration from the live cd?


Wrapping a shell script with tee

There is a bash script which prints some logs and allows some arguments. The script prints the logs to STDOUT. Let's say the script's name is `AAA.sh` I'd also like to make the script to print the logs to `STDOUT` and a `file`. This can be done with `tee`.               $ AAA.sh -a -b --c=d | tee 2012-07-03-080000.log      But my team often forgets to pipe the output to `tee`. We should save the logs to file. So I'd like to wrap the script with `tee`. What I want to do is               $ WrapAAAwithTee.sh -a -b --c=d      Then AAAwithTee.sh should print the log to STDOUT and a log file.   How can I wrap the AAA.sh?


What are possible reasons for erratic NTP synchronistation?

On a Ubuntu 10.04 system I noticed following strange NTP sync events:               Jul  3 02:19:51 hst ntpd[1432]: no servers reachable     Jul  3 02:36:55 hst ntpd[1432]: synchronized to 91.189.94.4, stratum 2     Jul  3 02:53:48 hst ntpd[1432]: time reset -10.407942 s     Jul  3 02:53:48 hst ntpd[1432]: kernel time sync status change 6001     Jul  3 02:53:48 hst dovecot: dovecot: Fatal: Time just moved backwards by 10 seconds. This might cause a lot of problems, so I'll just kill myself now. http://wiki.dovecot.org/TimeMovedBackwards     Jul  3 02:58:37 hst ntpd[1432]: synchronized to 91.189.94.4, stratum 2     Jul  3 02:58:37 hst ntpd[1432]: kernel time sync status change 2001     Jul  3 03:08:15 hst ntpd[1432]: no servers reachable     Jul  3 03:16:49 hst ntpd[1432]: synchronized to 91.189.94.4, stratum 2     Jul  3 03:17:01 hst CRON[28221]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)     Jul  3 03:18:04 hst ntpd[1432]: time reset +10.403648 s     Jul  3 03:22:41 hst ntpd[1432]: synchronized to 91.189.94.4, stratum 2      Where 91.189.94.4 europium.canonical.com and the only server line in `ntp.conf` is:               server ntp.ubuntu.com      The update at 2:36 seems pretty bogus because it is canceled out 25 minutes later. What could be possible reasons for this? I can think of:   * remote NTP server just provides the wrong time   * network problems (could a high latency introduce such drifts?)   * leap second induced bug (this should induce a crash instead, right?) If the first alternative was the problem how can I protect against this? Is NTPD smart enough to consult multiple NTP servers (when multiple `server` lines are available in `ntp.conf`) and detect if different answers deviate too much from each other?


What happens when you delete a hard link?

If you do `rm myFile` where `myFile` is a hard link, what happens?


Postfix stops working when /var mounted with noexec

I have `/var` on a separate partition, mounted with `noexec,nodev,nosuid`. Sending email through postfix does not work, I have following errors in my log:               postfix:  fatal: unknown service: smtp/tcp     postfix:  warning: private/smtp socket: malformed response     postfix:  warning: process /usr/lib/postfix/smtp pid 6569 exit status 1     postfix:  warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description     postfix:  warning: /usr/lib/postfix/smtp: bad command startup -- throttling      When I remount `/var` as `exec` and restart postfix, all works fine. I am aware of this bug, but as far as I can tell, my postfix is not running in `chroot`. Why does postfix need `exec` permissions on `/var` then ?


Cannot type keyword symbols in Linuxmint

I found that in my linuxmint 13.10, when I want to type a @(Shift + 2), the screen displays " (Shift + ' in windows). However, today the biggest problem is there is no ways to type |. Therefore, I would like to ask how can I change the keyboard settings?


How to add tcp6 on raspbian?

You have no necessity to install any additional packages. Everything should work fine. Thus check whether files /proc/net/tcp6, /proc/net/tcp exist. If they are absent, just add them. sir you gave this answer at given link:why dstat failed with --tcp option? can you please tell me about how to add tcp6 on raspbian. actually i am using raspberry pi for my thesis. thanks in advance.


Is it safe to create a regression test that relies on running out of file descriptor limit?

I'm writing a regression test for my modification of Nmap and I'm wondering if it's a good idea to create a test that would basically perform a large-scale connect() scan on 127.0.0.1/8, which would fail if the scanner is implemented poorly so that I would know once I've fixed this bug. Is this a bad idea to deliberately run out of open file descriptors to test this behavior? Does this kind of test affect other users or parent processes?


How to disable popup inscriptions in gnome 2?

When one moves mouse cursor to certain positions following inscriptions appear: "Window Menu", "Close Window" and so on. How to disable them?


List X random files from a directory

Is there a way to list a set of say, 30 random files from a directory using standard Linux commands? (in `zsh`) The top answer described here does not work for me (`sort` does not recognize the option `-R`)


Munin not Showing text

I installed munin server 2.0.21. Previously 1.2.5 was installed but I saved the configuration files and removed the old one . Then I install 2.0.21 Munin Server and 2.0.21 Munin-node and after sometime I open the webpage 127.0.0.1/munin. And I saw graphs like this. ![enter image description here](http://i.stack.imgur.com/Jy0tI.png) What might be the issue here. Host Info Redhat 5.9 64 bit Munin Server 2.0.21 Munin Node 2.0.21


How can I clear the list of recently accessed documents in Fedora?

When I click on the `Clear recent documents` item in the GNOME menu, it clears the list of recently used documents (as expected). How can I replicate this functionality from the command line?


wget not able to log into ftp

I am trying to use wget for downloading files from a ftp repository. The FTP repository has a login and password. I have to go through a proxy server which does not have a login and password. When I try to use the normal, `wget -r -c ftp://login:pass@download.site.co.in/` I find that it tries to login to the proxy server itself rather than the ftp server causing it to hang at that stage. using `--ftp-user` and `ftp-password` has the same effect. How can I get around this?


cshrc execute bashrc within itself?

My school has our Linux accounts using csh/tcsh by default. I, however, have a lot setup on my home bashrc and I'd like to use that at school. BUT there's also some important stuff that happens in our cshrc so I'd sort of like to not change my shell on each login. Is there a way for me to call or execute my bashrc within my cshrc and get the same effects or should I find out how to translate my bashrc into cshrc? I don't know crazy of an idea this is - I'm only really used to bashrc personally. Thanks for any help! Edit: I've decided to translate my cshrc into a bashrc so I can use bash... Ick Csh - anyone have input on translating this? My cshrc I'm looking to work on probably later today:               set defaultsdir=~defaults     # source ${defaultsdir}/linuxpaths     source ${HOME}/linuxpaths     # # add your custom shell commands here     # # see 'man tcsh' for more info     if ( $?prompt ) then       set autoexpand       set autolist       set cdpath = ( ~ )       set pushdtohome            set savehist=10000       set histfile=~/.history          # Load aliases from ~/.alias       if ( -e ~/.alias )    source ~/.alias          endif


Where are stored the Youtube videos cache in Google Chrome?

Google Chrome used to store YouTube videos in `/tmp`, but not for the last two versions. Nor could I find those files in `~/.cache/google-chrome`. Googling for this query produces Windows-specific results. Where are these files stored? I am using Fedora 14.


Install the virtual box guest additions Debian wheezy

I am trying to install the virtual box guest additions and it mounts successfully on to Debian wheezy. When I open this mounted drive I see a message in nautilus in the top right saying > "the medium has been detected as unix software **___ __ ___ __ ___ __**_Open > Autorun prompt" When I click on that I get the message: > Cannot find the autorun program


Convert links of downloaded website

I downloaded a website using:               wget -c --mirror -p http://www.somewebsite.com      for offline viewing and I just remembered that I forgot the --convert-links option! They are all on my hard drive right now. Is there a way to do --convert-links without redownloading the whole website?


Linux program to look into what you're downloading

Is there a linux program that allows you to look into your current download traffic? Something that can list all the addresses I am currently connected to and downloading from.


What is a good way of saying "run this after 15 minutes" on a shell?

I use this               sleep 900; <command>      on my shell. Just wanted to know is there is some alternate/better way that you use?


Run script when window manager loads using root owned 700 autostart file

One of the 3rd party proprietary GUI software I use requires typing login credentials every time I log in to my Cinnamon desktop. It does not support autologin of any kind. Therefore, I decided to automate this using xdotool. However, for this to work script needs to store login credentials. To preserve some kind of security, I would like to restrict access to the file containing password in plaintext to root user only. How can I autostart this script so it runs when user enters desktop session, but is not readable by user?


Dual boot Ubuntu 14.04 and CentOS 7.0

Problem in installing Ubuntu after CentOS 7.0: I have a laptop with a hard disk around 170Gb. After installing CentOS 7.0 I tried to install the Ubuntu 14.04 alongside with the CentOS 7.0. The Ubuntu installer could not recognise the existing CentOS 7.0 and I could not shrink the exisitng drive. Will change of installation sequence helps (remove the CentOS 7.0 and install Ubuntu first)?


Find the DVD-ROM path in FreeBSD

I do not know the path of my DVD-ROM and also my external hard drive to mount them in FreeBSD using the `mount` command. What command should I use to find their path?


using chown in linux

I want to assign www-data user full rights in folder /var/www/ and all of the files inside this folder. I have tried `chown www-data /var/www/`


SSH window forwarding with Xming

I have installed fedora 17 on the old desktop computer and put it to DMZ of my NAT network - i.e. whole computer is accessible via public ip address to the internet and could be called "server". I've allowed SSH connections on firewall - everything works perfect, but there is one huge problem. Both me and my friend abroad have Windows 7, so we are using putty + xming to forward windows. My computer (on the same LAN as "server") works without any problem (setting putty like this http://www.geo.mtu.edu/geoschem/docs/images/putty_4.jpg). Friend, however, he can't open any window (xming is running and putty is configured same as in my computer). He can login using putty, I can see him in `who` output, he can run console programs (e.g. nano), but he cannot start any GUI program. We tried `firefox`, `firefox &`, `gedit` and `gedit &`. But after issuing the command, nothing happened - just new command prompt and no process created at all... without any error message... I've also tried it using his account (from my computer) and everything worked... any ideas, what could cause the problem? is it possible, that some firewall could allow SSH traffic but block X11 forwarding?


Can I install some debs from Ubuntu on Debian Squeeze to get nice font rendering?

I have both Debian Squeeze and Ubuntu 10.04 machines; the font rendering in 10.04/10.10 is beautiful out of the box but Squeeze is still ugly even after hours and hours of messing with configuration. (IMO - I realize this is subjective.) Obviously Ubuntu is doing something right. Can I simply install a few packages from Ubuntu on my Debian box and have it work? If so, which are the relevant packages (cairo, freetype, xft are the libraries which seem to keep getting mentioned)? And which is the right version of Ubuntu to pull from? I'm currently on Lenny but I could upgrade to Squeeze. Alternately, are there patches I can pull from the Ubuntu deb sources that I can apply to to the corresponding Debian versions and rebuild?


delete key doesn't remove selected files

In file manager or on the desktop when I select a file and hit delete key it does nothing. Shift+delete works fine, as well as deleting in text editors. I'm using Debian Wheezy 7.4 with xfce desktop and nautilus 3.4.2 as the file manager.


Can't save / load iptables rules on Arch Linux via rc.d

**I can not load my saved iptables rules when the server reboots on Arch Linux. Any ideas?** The latest Arch updates are in place. I have followed Arch Linux's tutorial... neither either works. The following **do work** via the prompt as `root` user: _**1.** iptables-save & restore_               /usr/sbin/iptables-restore < /etc/iptables/iptables.rules      _**2.** rc.d_               rc.d start iptables        I have even attempted to run below as a cron on `root` with no joy:               @reboot /usr/bin/bash /usr/sbin/iptables-restore < /etc/iptables/iptables.rules > /home/me/boot-iptables.log      Surely I am missing something... everyone must be doing this*? * _By 'this' I mean wanting privileged port 80 going to 8080. I am going the wrong route for the simplest, cleanest way to do so? Everything was so good till now PacMan._


yum update baseurl error

I am new CentOS, I tried to install `openssh` using               yum -y install openssh-server openssh-clients      which resulted in               Loaded plugins: fastestmirror, refresh-packagekit, security     Loading mirror speeds from cached hostfile     Could not retrieve mirrorlist http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-6&arch=x86_64 error was     14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.rpmfusion.org'"     Error: Cannot find a valid baseurl for repo: rpmfusion-free      I tried `yum clean all` **did not help** `yum update --disablerepo=rpmfusion` shows               Loaded plugins: fastestmirror, refresh-packagekit, security      Error getting repository data for rpmfusion, repository not found


Issue while we install EPEL Packages on CentOS 6

I Just try to install system requirements of http://magento.com/resources/system-requirements , But facing the issues below attached the same. For my every install EPEL package, there was a issue of "No Package xxx available", I've Enabled EPEL Repository by,               ## RHEL/CentOS 6 64-Bit ##     # wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm     # rpm -ivh epel-release-6-8.noarch.rpm      ![No Package Available while we try to install EPEL package](http://i.stack.imgur.com/4y4EZ.png)


ioctl: invalid argument for HDIO_GET_IDENTITY

I wrote a program to get the details of hard disk drive using `HDIO_ ioctl calls`. For writing program, I'm referring `Documentation/ioctl/hdio.txt` in kernel source(2.6.32). Here is my main part of code:               fd = open("/dev/sda", O_RDONLY);  // validated fd.     retval = ioctl(fd, HDIO_GET_IDENTITY, &driveid);     if(retval < 0) {                 perror("ioctl(HDIO_GET_IDENTITY)");                 exit(3);     }      When I run(as root) the above code, I got below error:               ioctl(HDIO_GET_IDENTITY): Invalid argument      What is the wrong in the program? Why I'm getting error? **Additional Info** : OS: `CentOS-6.5`, kernel version: `2.6.32`, IA:`x86_64` (running on VMware). Result of `hdparm -i /dev/sda` is               SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     HDIO_GET_IDENTITY failed: Invalid argument


how get net switch info in soc?

I have a router device. cpu is mtk7620n. mtk7620n have a switch. How can i get information of the switch . `swconfig` show nothing. i think the switch have no driver. Anybody give me some recommendation!


How to setup a HTTPS Private Proxy Server on Debian 6 vps?

I have no a Debian 6.0 64 bits vps with 29 IP's, this is my first time using this system and I need a little help. First of all, what software do I need, and how can I setup a private proxy server on this vps? I will need the proxies to use in my PC with ProxyCap.


How to configure Unison for real peer-to-peer?

I have a handful of devices, and am considering keeping them in sync with Unison. The devices are not running all the time, they are switched off a few hours per day, not necessarily at the same time. None of the devices is running 24 hours a day. So I need **real peer-to-peer** , for instance see how a change (marked as `*`) propagates from A to B,C,D even though none has been running during all syncs:               A-on*   B-on    C-off   D-off     A-on*   B-on*   C-off   D-off     A-off*  B-on*   C-off   D-off     A-off*  B-on*   C-on    D-off     A-off*  B-on*   C-on*   D-off     A-off*  B-off*  C-on*   D-off     A-off*  B-off*  C-on*   D-on     A-off*  B-off*  C-on*   D-on*      Unfortunately, the Unison user manual recommends a **star topology** for more than 2 machines: > **Using Unison to Synchronize More Than Two Machines**   >   >  Unison is designed for synchronizing pairs of replicas. However, it is > possible to use it to keep larger groups of machines in sync by performing > multiple pairwise synchronizations. > > If you need to do this, the most reliable way to set things up is to > organize the machines into a “ **star topology** ,” with one machine > designated as the “hub” and the rest as “spokes,” and with each spoke > machine synchronizing only with the hub. The big advantage of the star > topology is that it eliminates the possibility of confusing “ **spurious > conflicts** ” arising from the fact that a separate archive is maintained by > Unison for every pair of hosts that it synchronizes. Despite that, is there any way to achieve real peer-to-peer with Unison?


Why can't I access to my ftp server with my local user account?

First of all I'm using Centos 6 server, putty and wordpress.org I followed the instructions of this link to set up vsftpd and ftp in centos server. http://www.servermom.org/how-to-install-and-setting-up-vsftpd-on-centos- server/535/#comment-1343 For the vsftpd.conf file, these were the changes I made: anonymous_enable=NO local_enable=YES chroot_local_user=YES All of them are uncommented, then I restarted the vdftpd service. For iptables I enable input and output for port 21. My problem is when I type in the useraccount and password for authentication before I can access ftp://domain.com, seems like the server is not recognizing my username and password which is the same I have been using to log in into centOS server. Then I found something on google about getsebool that the ftp_home_directory is turn off and I need to turn it on with setsebool -P Ok, now on able to connect using ftp in putty, but not in the web browser or filezilla. Any ideas??


Tmux config not retaining PWD on new-window or window split

So I'm trying to update my `.tmux.conf file` to reflect the change for `-c` in `new-window`. I've added this to my conf and it's not working unfortunately. My new windows and panes always start in `~/`:               # Saner splitting.     bind v split-window -c $PWD -h     bind s split-window -c $PWD -v          # Autorename sanely.     setw -g automatic-rename on          # Better name management     bind c new-window -c $PWD      My expected behavior is that my new pane or window will be in the directory of which ever pane I previously was in was. So If I'm in Window 1 that is in `~/Sites/project`, my new window will also be there.


Is my understanding of kernels correct?

System: Application OS: Scheduler, VMM, IPC, FS Drivers, dispatchers, VFS The above would be a monolithic kernel. In a monolithic kernel all core OS functions are separate from user space. Functions such as the FS are handled completely by the kernel. This leaves the end user/dev open to write applications that rely solely on the kernel to emulate and process the functions. The BSD tree, AIX, and HP-UX are good examples of monolithic kernels. System: Application User Mode: Application IPC, Unix Server, Drivers, File Server OS: Basic IPC, VMM, Scheduling This is a microkernel. A microkernel is responsible solely for physical emulation of the machine code. It provides a more secure functionality, but also allows for better hardware processing. User space is where drivers are handled, sometimes grating DMA. Also, it can improve computing processing time if the user space is streamlined for direct machine emulation. JXOS and various nanokernels are good examples. System: Application User Mode: Drivers, Unix Server, Application IPC OS: Microkernel, Kernel Drivers, IPC, HAL This is a hybrid kernel. A hybrid kernel is mix between a monolithic kernel and a microkernel. Software drivers are handled in user mode, but hardware drivers are handled by the kernel. This allows for a lot of flexibility in design, as some packages and application functions can run directly against the kernel. However, this leaves the kernel open to a lot of security vulnerabilities. The most well-known hybrid kernel is Windows NT. My architect was testing my knowledge of kernels, and this is what I sent him. He said that I wasn't wrong, I just have a very different approach to it. When interrogated about it, he just told me it was different. How is it different? Does it look different?


How to output comma-separated strings using bash brace expansion

I'd like               $ echo a{b,c,d}      to output a comma-separated list like               ab,ac,ad      instead of the usual output               ab ac ad      What's the easiest way to do that on the command line?


Which getty should I use for /dev/tty1 - tty6 text consoles in linux, agetty or something other

I'm configuring LFS linux and I want to select right "getty" for `/etc/inittab` to handle text consoles /dev/tty1 - /dev/tty6 (the text consoles handled by linux kernel, with output on first display). There is `agetty`, is it good for tty1, or it is limited only for modems like ttyS0? If I should use other implementation of getty, what is the package name?


Unexpected end of file error when executing script

Can somebody help me debug this simple script. Been trying for 2 hrs now but I cant seem to get it to work.               #!/bin/bash          echo "Search for MMSC or WAP connectivity errors"          sftpErrorCount=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| wc -l)          if [ "$sftpErrorCount" -gt 0 ]     then     sftpErrorDate=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| tail -1)     echo "Error found at around $sftpErrorDate please check FTP logs"          else     echo "No errors found"      Error when I execute the script               sh test_script.sh     Search for MMSC or WAP connectivity errors     test_script.sh: line 14: syntax error: unexpected end of file


Shell script time output over java enviroment

I am running a script from java program using sshxcute API. Script contains:               #!/bin/sh     data=`stat -c%y filename`     echo $data      Script running on bash gives output:               2014-03-08 13:26:29.335545828 -0800      Script running through java program gives output:               2014-03-08 21:26:29.335545828 +0000      I think the -0800 is getting added. I need output in first format. Anyone have any idea how to resolve the issue?


dd outputting: "function not implemented" when trying to write to /dev/sg11

I'm trying to use the following command:               dd if=/dev/urandom of=/dev/sg11 bs=16K count=1      But when executing it, I get the following error:               dd: writing `/dev/sg11': Function not implemented      When I try with `dd if=/dev/urandom of=/dev/sg11 bs=16K count=1 conv=fsync`, then I get a `cannot allocate memory` error, which becomes a `Function not implemented` error when I up the bs size. What causes this issue and how can I fix it? UPDATE: Sometimes it will tell me `cannot allocate memory`, and then it will again tell me that `function not implemented` for the same bs value.


RPM: Installed (but unpackaged) file(s) found on Centos 6 with CUPS 1.7.1

Trying to install CUPS 1.7.1 on Centos 6.5 via RPM, I use:               # rpmbuild -ta cups-1.7.1-source.tar.bz2 --without dbus --without libusb1      but stops with below error:               Checking for unpackaged file(s):           /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/cups-1.7.1-1.x86_64      error: Installed (but unpackaged) file(s) found: /usr/share/cups/usb/org.cups.usb-quirks          RPM build errors:      Installed (but unpackaged) file(s) found:           /usr/share/cups/usb/org.cups.usb-quirks


Linux equivalent of Cisco's "begin" command

In the Cisco IOS, you can filter and manipulate the output of commands using various built-in tools. Some of these have clear Linux equivalents. For example, 'exclude' and 'include' provide 'grep -v' and 'grep' behavior. The "begin" command will output all input text **after** it matches a RegEx pattern. Is there a Linux equivalent for this type of behavior?


bash force copy over same file

Our sysadmin has created a backup system that creates snapshots of the hard drive. When I try to restore an older version from the snapshot:               cp /path/to/snapshots/foo.bar /path/to/folder/foo.bar      I get an error:               cp: `/path/to/snapshots/foo.bar' and  `/path/to/folder/foo.bar' are the same file.       I can delete the file and copy it but I wanted to know if there is a way to do this with cp. I know that the files are not linked because:   1. I can change the content of the source and the snapshots are kept unchanged (tested)   2. I can delete the source and the snapshots are there to restore (tested)   3. The files are stored on the university computation cluster. If something like that were true, somebody would have been fired already (or at least shouted at).  Nevertheless, the `inode` number of the files is the same The cluster is implemented over red hat linux and I don't know what is the file system df result:               Filesystem           1K-blocks      Used Available Use% Mounted on     <ipadress>:/vol/hpc/storage                           67633152  67633152         0 100% /storage     <ipadress>:/vol/hpc/storage                          2186805248 982498048 1204307200  45% /storage      stat result:                 File: `/path/to/snapshots/foo.bar'       Size: 404         Blocks: 8          IO Block: 4096   regular file     Device: 17h/23d Inode: 19750461    Links: 1     Access: (0644/-rw-r--r--)  Uid: (<num1>/  yotama9)   Gid: ( <num2>/ <groupname>)     Access: 2012-01-22 00:03:27.246852000 +0200     Modify: 2012-01-19 23:10:32.746397000 +0200     Change: 2012-01-19 23:10:32.746397000 +0200       File: `/path/to/folder/foo.bar'       Size: 404         Blocks: 8          IO Block: 4096   regular file     Device: 17h/23d Inode: 26335134    Links: 1     Access: (0644/-rw-r--r--)  Uid: (<num1>/  yotama9)   Gid: ( <num2>/ <groupname>)     Access: 2012-01-24 16:03:48.732453000 +0200     Modify: 2012-01-24 16:03:30.728900000 +0200     Change: 2012-01-24 16:03:30.728900000 +0200


liveCDs detecting wrong video card

I just replaced my video / graphics card with a new model, the AMD firepro m6100. None of my ubuntu 13.10 based liveCDs are able to run correctly (manually running startx from tty1 fails, so that's probably part of it). I suspect the root of the problem is that Dell (supposedly) changes the hardware ID for their hardware. I need to find a way around this so I can not only run a live environment but also repair my broken GRUB install, and eventually get my system running with the new video card. lspci - in the live environment - spits out the following:               1:00.0 VGA compatible controller: ... [AMD/ATI] Saturn XT [Radeon HD 8950M] (prog-if 00 [VGA Controlle...     Subsystem: Dell Device 04a4     Flags: bus master, fast devsel, latency 0, IRQ 51     Memory at d0000000 (64-bit, prefetchable) [size=256M]     Memory at e0000000 (64-bit, prefetchable) [size=8M]     I/O ports at 7000 [size=256]     Memory at e4100000 (32-bit, non-prefetchable) [size=256K]     Expansion ROM at e4140000 [disabled] [size=128K]     ...     Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010     ...     Kernel driver in use: radeon


How to run java service as a non-root user on CentOs 6

I have a script that starts a Java application as a service on CentOS 6:               #!/bin/sh     # chkconfig: - 80 20          SERVICE_NAME=cn4server     PATH_TO_JAR=/usr/local/share/myserver/cn4server.jar     PID_PATH_NAME=/usr/local/share/myserver/cn4server-pid     case $1 in         start)             echo "Starting $SERVICE_NAME ..."             if [ ! -f $PID_PATH_NAME ]; then                 nohup java -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &                             echo $! > $PID_PATH_NAME                 echo "$SERVICE_NAME started ..."             else                 echo "$SERVICE_NAME is already running ..."             fi         ;;         stop)             if [ -f $PID_PATH_NAME ]; then                 PID=$(cat $PID_PATH_NAME);                 echo "$SERVICE_NAME stoping ..."                 kill $PID;                 echo "$SERVICE_NAME stopped ..."                 rm $PID_PATH_NAME             else                 echo "$SERVICE_NAME is not running ..."             fi         ;;         restart)             if [ -f $PID_PATH_NAME ]; then                 PID=$(cat $PID_PATH_NAME);                 echo "$SERVICE_NAME stopping ...";                 kill $PID;                 echo "$SERVICE_NAME stopped ...";                 rm $PID_PATH_NAME                 echo "$SERVICE_NAME starting ..."                 nohup java -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &                             echo $! > $PID_PATH_NAME                 echo "$SERVICE_NAME started ..."             else                 echo "$SERVICE_NAME is not running ..."             fi         ;;     esac       It works well, but it runs as a root. How can I change the script to run the Java application on behalf of another user?


Function key mappings in telnet session to Universe Application

Our client uses Termtek terminals to connect to their Universe platform. More terminals needed and we can't get any. The alternative is to get winboxes and run wintegrate or try and get a Linux terminal working. Configured xterm with keybindings that I need for the `F1`-`F5` keys. In `xterm` session these bindings work, however when I connect via telnet to the Universe sessions, they don't. For `F1` I get ^[OP. I need EX and return. `F2` I need + and return and so forth. I have been trawling the net with not much luck. Indications are it's to to do with the terminal settings rather than on the host side however I can't seem to find anything concrete. I found that the the backspace button did not work(even though worked in terminal session) and used a script I found on this forum to run with the telnet command. This tends to suggest that the terminal keyboard mappings need to change for Telnet sessions. The supplier has set up the universe platform for us to test but only have 10 days before it expires. Hope I can get some help before then


Recommend Course of Action?

I have an Asus VivoBook that came with windows installed on it. For amusement and profit, I have been hacking away trying to to serve a website from behind a wireless router at my house. At some point, I needed to reinstall Ubuntu on the machine, but the wireless card drivers appear to have been corrupted or deleted. After further meddling, the best solution seems to be to shell out for a Windows disk and use that to get the drivers I need, then just reinstall Ubuntu. Does anyone have any other suggestions? I've tried to find the actual drivers and put them on a flash drive, but the drivers themselves are elusive. If anyone knows specifically where I can find them, or has fixed this before, I'm open to suggestions.


How can I use `find` and sort the results by mtime?

I want to use `find` but sort the results reverse chronologically as with `ls -ltr`. Is this possible through any combo of flags or pipelines?


Why does this "while read" work in a terminal, but not in a shell script?

I ran into this interesting issue while populating my WM bar with info text, which is applied by setting the root window's title, i.e. `xsetroot -name "clever words"` To this end, printing a fortune works fine in a terminal:               fortune -s | while read -r; do xsetroot -name "$REPLY"; done      Yet that same fails when run from a shell script:               #!/bin/sh     cat /tmp/afile | while read; do echo "$REPLY"; done      Produces: > $ sh afilereader   >  afilereader: 2: read: arg count Of course this is remedied by assigning our fortune result to a variable, then using xsetroot with said variable. But I'd still like to understand _why_ this does not work in a script. I realize each command on either side of the pipeline is run within it's own subshell, but fail to see how their localized variables could affect the while read loop. Or are variables out of scope even between the loop iterations? What am I missing? **Update:** The `sh` I used is linked to dash, which is in the process of being made POSIX compliant. Using the more venerable `bash` solved this.


"provide net" in gentoo init script doesn't work as I thought

I'm running into a strange (to me) problem. I'm running a gentoo with two net interfaces: `enp5s0` (wired interface) and `wlan0` (wifi). When I try to run a program, for example `openvpn`, from its script in `/etc/init.d`, it outputs:               * WARNING: openvpn is scheduled to start when net.enp5s0 has started      and doesn't start if the interface `enp5s0` is not started, even if the other interface is up. In `/etc/init.d/openvpn`, I've got these lines:               depend() {             need localmount net             use dns             after bootmisc     }      and in `/etc/init.d/net.enp5s0` and `/etc/init.d/net.wlan0` (which are in fact symlinks to `/etc/init.d/net.lo`, Gentoo deals with the name of the script to know what it should do):               depend()     {             [...]                  case "${IFACE}" in                     lo|lo0) ;;                     *)                             after net.lo net.lo0 dbus                             provide net                             ;;             esac                  [...]     }      So, as I understand the case, whichever of my interface provides the `net` "capacity" (I don't have the correct/canonical word for it), and `openvpn` should only rely on this capacity, and not on a particular interface. The same problem occurs with all the program that have the `need net` dependency. What am I missing here? My `uname -a` if it can be of some help: `Linux yavin 3.7.10-gentoo-r1 #2 SMP Sat Apr 20 16:27:52 CEST 2013 x86_64 Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz GenuineIntel GNU/Linux`


I am running Ubuntu:               #lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 12.04.4 LTS     Release:    12.04     Codename:   precise     Kernel info:          3.8.0-38-generic #56~precise1-Ubuntu SMP Thu Mar 13 16:23:47 UTC 2014 i686 i686 i386 GNU/Linux      The source that I am having is : **linux-lts-raring-3.8.0** When I am trying to make my first driver I get the following errors:               make -C /usr/linux-lts-raring-3.8.0 SUBDIRS=/home/drdr/Documents/drivers/first_driver modules     make[1]: Entering directory `/usr/linux-lts-raring-3.8.0'            WARNING: Symbol version dump /usr/linux-lts-raring-3.8.0/Module.symvers                is missing; modules will have no dependencies and modversions.            Building modules, stage 2.       MODPOST 1 modules     /bin/sh: 1: scripts/mod/modpost: not found     make[2]: *** [__modpost] Error 127     make[1]: *** [modules] Error 2     make[1]: Leaving directory `/usr/linux-lts-raring-3.8.0'     make: *** [default] Error 2      Then I went to scripts/mod/ in my source directory I typed make:               root@drdr:/usr/linux-lts-raring-3.8.0/scripts/mod# make modpost     cc     modpost.c   -o modpost     In file included from modpost.c:18:0:     modpost.h:12:23: fatal error: elfconfig.h: No such file or directory     compilation terminated.     make: *** [modpost] Error 1      **Update** I found a related file mk_elfconfig.c. Is there a way to generate elfconfig.h from this;               root@drdr:/usr/linux-lts-raring-3.8.0/scripts/mod# ls -ld mk_elfconfig.c      -rw-r--r-- 1 root root 1234 Feb 19  2013 mk_elfconfig.c      Why I am getting this error? I believe the version of the source code and what is running are the same. The Makefile and source code for the driver is given here **Update** after copying config- from /boot to my source code as .config: I did               root@drdr:/home/drdr/Documents/drivers/linux-lts-raring-3.8.0#make oldconfig      scripts/kconfig/conf --oldconfig Kconfig     #     # configuration written to .config     #          root@drdr:/home/drdr/Documents/drivers/linux-lts-raring-3.8.0# make prepare     scripts/kconfig/conf --silentoldconfig Kconfig       SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h       SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h       SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h       SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h       HOSTCC  arch/x86/tools/relocs       WRAP    arch/x86/include/generated/asm/clkdev.h       CHK     include/generated/uapi/linux/version.h       UPD     include/generated/uapi/linux/version.h       CHK     include/generated/utsrelease.h       UPD     include/generated/utsrelease.h       CC      kernel/bounds.s       GEN     include/generated/bounds.h       CC      arch/x86/kernel/asm-offsets.s       GEN     include/generated/asm-offsets.h       CALL    scripts/checksyscalls.sh     root@drdr:/home/drd/Documents/drivers/linux-lts-raring-3.8.0#       But still same error in driver compilation:               root@drdr:/home/drdr/Documents/drivers/first_driver# make     make -C /usr/linux-lts-raring-3.8.0 SUBDIRS=/home/drdr/Documents/drivers/first_driver modules     make[1]: Entering directory `/usr/linux-lts-raring-3.8.0'            WARNING: Symbol version dump /usr/linux-lts-raring-3.8.0/Module.symvers                is missing; modules will have no dependencies and modversions.            Building modules, stage 2.       MODPOST 1 modules     /bin/sh: 1: scripts/mod/modpost: not found     make[2]: *** [__modpost] Error 127     make[1]: *** [modules] Error 2     make[1]: Leaving directory `/usr/linux-lts-raring-3.8.0'     make: *** [default] Error 2


What linux editor can open a 200G file for editing within a minute or two?

I'm looking for an editor that will open the file in chunks (not try to read the whole file into memory) as I'm trying to hand-edit a 200G file.


How can I apply caret-substitution to my nth-last command?

I regularly find myself having to execute a lengthy command on a file, then process the results with other commands. To process the next file, I usually rerun the same command by hitting the `Up` key until I find the command I want and arduously replace the old filename with the new filename. Is there a way to combine caret substitution (`^oldfile^newfile`) with the _n_ th-last command? I have (unsuccessfully) tried to pipe the _n_ th-last command into the substitution like so:               $ !-4 | ^old^new      Of course, I am open to other suggestions. These little shortcuts really help with productivity...


How to interpret traceroute information?

For example in this pic taken from Wikipedia [Bigger Version] ![alt text](http://i.stack.imgur.com/nwP2c.png)   1. What are all these 12 server names that are listed? I know they are servers that are supposed to be the path that the network packet had to travel to reach the destination. But why do I need to go to any server except the server that actually serves the request by providing me the file I requested?   2. What are the three timing informations that are mentioned for each server name? * * * Isn't the process supposed to be like this (copied from here)? > The browser communicated with a name server to translate the server name > www.howstuffworks.com" into an IP Address, which it uses to connect to the > server machine. The browser then formed a connection to the server at that > IP address on port 80. (We'll discuss ports later in this article.) > Following the HTTP protocol, the browser sent a GET request to the server, > asking for the file "http://www.howstuffworks.com/web-server.htm." (Note > that cookies may be sent from browser to server with the GET request -- see > How Internet Cookies Work for details.) The server then sent the HTML text > for the Web page to the browser. (Cookies may also be sent from server to > browser in the header for the page.) The browser read the HTML tags and > formatted the page onto your screen.


power management of USB-enclosed hard drives

With a typical USB hard drive enclosure, is the full range of drive power management functionality available? **edit** : moved this into a separate question: ~~In what may be an unrelated matter: is it possible to suspend a PC without unmounting an attached USB-powered drive, and then remounting it on resume? This is the behaviour I'm currently seeing (running Ubuntu linux 10.10).~~ **/edit** Are there certain models or brands that provide more complete control over this aspect of drive operation? My Friendly Neighbourhood Computer Store carries (part of) the Vantec Nexstar product line.


getting access to the itunes store

I have minx 13 XFCE installed on both my laptop and my desktop. For purchasing music I had no problem in XP with running iTunes. In Mint however, this is more a challenge because there is no itunes voor linux. There are some 'workarounds' however. I managed to install the latest itunes on my mint machine using wine. Itunes starts, but can't connect to the store. I found one succes-story from a recent itunes version. However, I'm thinking if it might be a better solution to install a small xp version using nlite in a virtual box, rather than messing around with wine. What is my best solution to have access to the itunes store in mint?


How to samba automatically add user and share they home?

_Linux OpenSuse 12.3 , samba server 3.6.12 ._ Sorry if this is a dummy question, I just looking and found no answer for that. My samba is configured and working with `security = user` and today is used only for two users where I was added manually at passwd and smbpasswd.   This server have nothing of windows AD configured or authenticated . Now I need to use this server with other users, like per user home folder...   where each user what access this server will see they own folder and able to write anything there. I already configured the [homes] option, which work fine for users what already exists.   Of course, not work for new users which I don't added at passwd and smbpasswd;. How I automatically add new users "on demand" ? in someway where we don't need to create a explicit password? I've configured the `add user script` but they don't run when a differ user try access the server. **What is my objective :**   * The name of samba server is jdiserver.   * Let's suppose the user John will access this server by windows `\\jdiserver` at first time.    * If is they first access and the user doesn't exists at linux, the user should automatically added at passwd and smbpasswd    * they homedir should be created and shared at they connection .    * All this , without asking passwords... Is this possible? What I missing? This is my configuration today:               [global]         workgroup = XXX         passdb backend = tdbsam         printing = bsd         map to guest = Bad User         include = /etc/samba/dhcp.conf         logon path = \\%L\profiles\.msprofile         logon home = \\%L\%U\.9xprofile         logon drive = P:         usershare allow guests = No         domain logons = No         domain master = No         netbios name = jdiserver         server string = jdiserver         wins server = 101.0.0.1 101.0.0.2         wins support = No         deadtime = 5         security = user              add user script = sh /etc/samba/adduser.sh %u          machine password timeout = 1800          [homes]       comment = Home Directories       valid users = %S, %D%w%S       browseable = No       read only = No       inherit acls = Yes       path = /mnt/temp_disk/WIN_BACKUP/%S       force user = nobody       force group = nobody


Count the number of words of particular length from a file

I've used the below command to count the number of words in a file:               tr ' ' '\n' < Filename | grep -c "WORD"      This returns the word list with counter. Now I want to count the number of words of a particular length. For example, given a file with these contents:               employee paresh emp employee jayesh hitesh      When I run the shell script with argument `6`, it should display/count words with 6 characters (`paresh`, `jayesh`, and `hitesh`, with count `3`). How can I do that?


Language bar in RHEL 6

I'm having a problem with the language bar specifically in RHEL 6.5. I need the following:   1. Language bar on the panel with either 2-letter code or a flag   2. Switch languages with Caps Lock, optionally turn lead on/off on it By default 1 & 2 are not working. Applying custom settings in `System->Keyboard` does not help. The application QXKB somehow helps bullet #1, but is too unstable to be usable.


Can an OpenSSH server forward inbound traffic to another server?

In my current work setup, I have:   * Windows 7 laptop   * Ubuntu virtual host / SSH   * Windows 2k8 guest I'd like to be able to RDP from my laptop into the Windows guest without having to open additional ports or have Windows RDP directly exposed to the internet. If I forwarded localhost:10467 to ubuntuhost:22 using Putty, can OpenSSH forward this connection to windowsguest:3389 or do I need to start looking at VPN solutions?


Using dget to build package from mentors.debian.net

I'm trying to build this package: http://mentors.debian.net/package/isbg I thus ran:               dget http://mentors.debian.net/debian/pool/main/i/isbg/isbg_0.99-5.dsc      But the gpg verification fails:               dget: retrieving http://mentors.debian.net/debian/pool/main/i/isbg/isbg_0.99-5.dsc     --2014-05-21 14:52:20--  http://mentors.debian.net/debian/pool/main/i/isbg/isbg_0.99-5.dsc     Resolving mentors.debian.net (mentors.debian.net)... 185.22.221.46     Connecting to mentors.debian.net (mentors.debian.net)|185.22.221.46|:80... connected.     HTTP request sent, awaiting response... 200 OK     Length: 1070 (1,0K) [text/plain]     Saving to: ‘isbg_0.99-5.dsc’          100%[======================================>] 1 070       --.-K/s   in 0s                2014-05-21 14:52:20 (179 MB/s) - ‘isbg_0.99-5.dsc’ saved [1070/1070]          dget: using existing isbg_0.99.orig.tar.bz2     dget: using existing isbg_0.99-5.debian.tar.xz     isbg_0.99-5.dsc:     dscverify: isbg_0.99-5.dsc failed signature check:     gpg: Signature made sam 19 avr 2014 05:28:51 EDT using DSA key ID 50D0AE60     gpg: Can't check signature: public key not found      I did download the author's gpg public key via:               gpg --keyserver pool.sks-keyservers.net --recv-keys 50D0AE60      What am I doing wrong?


Qt program not invoked by cron

I had a simple Qt program, when running, it shows a simple window with a countdown timer. If you might be interested in the code, please see here. I had crontab line               * * * * * /home/my-user-name/Documents/bin/program      When executing the comment `/home/my-user-name/Documents/bin/program`, the program runs correctly. But it's not invoked by the `cron`. I have multiple cron jobs, all run smoothly except this one. My question is: Do you have any idea what might cause this? Qt problem? `PATH` problem? _I have searched around for`cron`, and tried almost all the tips._


Can the grub2 bootloader replace Windows bootloader partition?

I'm dual-booting Windows and Kali Linux on my laptop, using GRUB 2 as the bootloader. Can I remove the partition Windows 7 creates for the bootloader? It is the 100 MB partition labeled "System Reserved." I ask because I'm not sure how GRUB 2 goes about booting Windows. I know HBCD has an option to boot a Windows Vista/7 OS, and I believe it bypasses the bootloader partition because I've used it to boot workstations that had corrupted bootloaders before. Can it be done?


How to get multiple lines out of a file by a regex? I often would like to get multiple lines / modify multiple lines by a regex. A example case: I am trying to read part of an XML/SGML file (they are not necessarily well formed or in a predictable syntax, so a regex would be safer than a proper parser. In addition I would like to be able to do this also whit completely unstructured files where just some key words are known.) in a shell script (running on Solaris and Linux). Example XML:               <tag1>      <tag2>bar</tag2>     </tag1>     <tag1>      <tag2>foo</tag2>     </tag1>      From this I would like to read the `<tag1>` if it contains `foo` somewhere within it. A regex like `(<tag1>.*?foo.*?</tag1>)` should give the right part but tools like `grep` and `sed` only work for me with single lines. How can I get               <tag1>      <tag2>foo</tag2>     </tag1>      in this example?


Copying a file that is written at the same time

This related question can't solve my exact problem, so I'm writing a similar question. My scenario is the following: a program (run by wine) writes to a file sized about 10-500 KB. About 1 KB addition happens on each write event (lines are added to the end of the file, no other writing methods exist), the interval between writes is from microseconds to 240 minutes. (Generally, the interval between writes is between 3 and 10 minutes, but the aforementioned time borders are the theoretically possible limits).   I cannot modify this interval, and it is random from the point of view of the user. The write interval changes, so it is possible that the **ABCD** write events are the following: A-B 60 min; B-C 5 sec; C-D 357.4 sec and so on. I want to copy the file about every 25 to 30 minutes to edit it externally (automatically, of course). What is the best solution that **guarantees** no race condition will appear? I don't want to write a timing algorithm, but, if it is necessary, I can do that. Also, the copying - external editing could be expanded to the interval of 1 day, no more. Wine doesn't allow me to redirect the output.               $ grep sda4 /etc/mtab     /dev/sda4 /foo xfs rw,relatime,attr2,delaylog,noquota 0 0      **UPDATE** I cannot collaborate with the writing process, and the file in question is a strictly formatted plaintext file.


undelete a just deleted file on ext4 with extundelete

Is there a simple option on `extundelete` how I can try to undelete a file called `/var/tmp/test.iso` that I just deleded? (it is not so important that I would start to remount the drive read-only or such things. I can also just re-download that file again) I am looking for a simple command whith that I could try if I manage to fast- recover it. I know, it is possible with remounting the drive **in read-only** : (see How do I simply recover the only file on an empty disk just deleted?) But is this also possible somehow **on the still mounted disk?**


Debian Wheezy vs Logitech Quickcam E2500

I've a bought a QBox-1000, I've installed Wheezy, and some services (SSH, Samba, Transmission, etc). Now I would like to step on a next level. I want to know what is what and how to do some advanced operations eg. I connected a Logitech Quickcam E2500, something went wrong, because first I could record with it, but there wasn't sound. Then I've tried several things, and now the system doesn't load the cameras's driver (may be there is no driver at all). Please let me know what is the theory and after that tell me how MAKE (or load or install) the specific driver. (as I see I need this driver / modul: GSPCA ) As I know the theory is:   * connect the device   * install / setup the driver   * install / setup application   * use the application               root@qbox:~# uname -a     Linux qbox 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686 GNU/Linux          root@qbox:~# lsusb     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 003: ID 1687:2029 Kingmax Digital Inc.     Bus 003 Device 002: ID 046d:089d Logitech, Inc. QuickCam E2500 series          root@qbox:~# dmesg | grep usbcore     [    9.865932] usbcore: registered new interface driver usbfs     [    9.866022] usbcore: registered new interface driver hub     [    9.881131] usbcore: registered new device driver usb     [   10.393143] usbcore: registered new interface driver usb-storage     [   11.587918] usbcore: registered new interface driver snd-usb-audio      I found this and this, but if I take a look in my filesystem, there are no files like that:               /lib/modules/3.2.0-4-686-pae/kernel/drivers/media/video/gspca/gl860/gspca_gl860.ko     /lib/modules/3.2.0-4-686-pae/kernel/drivers/media/video/gspca/gspca_spca500.ko      There are the folders, but they are empty. May be I should build my own driver from source, but all attempts have failed. If I want to (re)install the package:               root@qbox:~# apt-get install linux-image-3.2.0-4-686-pae     Reading package lists... Done     Building dependency tree     Reading state information... Done     linux-image-3.2.0-4-686-pae is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      or the header...               root@qbox:~# apt-get install linux-headers-3.2.0-4-686-pae     Reading package lists... Done     Building dependency tree     Reading state information... Done     linux-headers-3.2.0-4-686-pae is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.          root@qbox:~# apt-get --reinstall install linux-image-3.2.0-4-686-pae     Reading package lists... Done     Building dependency tree     Reading state information... Done     0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.     Need to get 22.9 MB of archives.     After this operation, 0 B of additional disk space will be used.     Get:1 http://ftp.debian.org/debian/ stable/main linux-image-3.2.0-4-686-pae i386                                                  3.2.54-2 [22.9 MB]     Fetched 22.9 MB in 7s (3,139 kB/s)     Preconfiguring packages ...     (Reading database ... 45853 files and directories currently installed.)     Preparing to replace linux-image-3.2.0-4-686-pae 3.2.54-2 (using .../linuximage-3.2.0-4-686-pae_3.2.54-2_i386.deb) ...     Unpacking replacement linux-image-3.2.0-4-686-pae ...     Examining /etc/kernel/postrm.d .     run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-4-686-pae /boot/vmlinuz-3.2.0-4-686-pae     run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-4-686-pae /boot/vmlinuz-3.2.0-4-686-pae     Setting up linux-image-3.2.0-4-686-pae (3.2.54-2) ...     Running depmod.     Examining /etc/kernel/postinst.d.     run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-4-686-pae /boot/vmlinuz-3.2.0-4-686-pae     update-initramfs: Generating /boot/initrd.img-3.2.0-4-686-pae     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168f-2.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168f-1.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8105e-1.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-3.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-2.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168e-1.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for module r8169     W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for module r8169     run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-4-686-pae /boot/vmlinuz-3.2.0-4-686-pae     run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-4-686-pae /boot/vmlinuz-3.2.0-4-686-pae     Generating grub.cfg ...     Found linux image: /boot/vmlinuz-3.2.0-4-686-pae     Found initrd image: /boot/initrd.img-3.2.0-4-686-pae     Found Windows Recovery Environment (loader) on /dev/sdb1     done      After reinstall...               root@qbox:~# dmesg | grep usbcore     [    9.900699] usbcore: registered new interface driver usbfs     [    9.900787] usbcore: registered new interface driver hub     [    9.915960] usbcore: registered new device driver usb     [   10.408958] usbcore: registered new interface driver usb-storage     [   11.391045] usbcore: registered new interface driver zc3xx     [   11.566040] usbcore: registered new interface driver snd-usb-audio      This one I missed: zc3xx


How to put a tunnel in a tunnel?

I know I can create an ssh tunnel and then tell a program (with tsocks) to use it for networking. But. How can I put an ssh tunnel in an ssh tunnel? I mean I can't again use the tsocks in tsocks because I can't provide a good tsocks.conf [and not a solution even if someone could:)]. So how can I tell an ssh tunnnel to use an ssh tunnel? ### Scenario:               PC-A ->> ROUTER -->> PC-B        * PC-A: I'm this guy   * ROUTER: this is the router (we don't want port forward on it, only ssh)   * PC-B: the machine that I need to ssh tunnel from PC-A. So I need a tunnel to the router. Then I need a tunnel that uses the router's tunnel so that I can reach PC-B behind NAT.


Manually assign a value when inet_ntoa does return an ip address

Code:               foreach $hostname (@hostnameUniqueSorted){         $ipaddr = inet_ntoa((gethostbyname($hostname))[4]);         if(chomp($ipaddr) =~ '^$') $ipaddr == "ip not avail";   <-- doesn't work     }      If the host doesn't return an IP address, it would break and show:               Usage: Socket::inet_ntoa(ip_address_sv) at ./abc line 24.      How do I catch it and assign maybe 'ip not avail' for the $ipaddr? I added the last line but it doesn't work.


bridged networking with kvm

I'm trying to get a guest virtual machine connected to my network using bridging. I've come across a couple of resources online, but they seem to be out of date, deal with xen or Ubuntu or don't seem to be complete. The host is running CentOS 5.5 and I'm using libvirt to manage the VMs so I use it to create the VMs and start and stop them. I have the bridge created (br0) and have attached eth0 to it. The VM doesn't seem to get an IP address, I want to use DHCP for addresses, I'll setup a static lease for the VM. ifconfig from the host:               br0   Link encap:Ethernet  HWaddr 00:1A:4D:53:C3:A6             inet addr:192.168.1.121  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::21a:4dff:fe53:c3a6/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:5222 errors:0 dropped:0 overruns:0 frame:0           TX packets:470 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:753743 (736.0 KiB)  TX bytes:47868 (46.7 KiB)          eth0  Link encap:Ethernet  HWaddr 00:1A:4D:53:C3:A6             inet6 addr: fe80::21a:4dff:fe53:c3a6/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:103200 errors:0 dropped:0 overruns:0 frame:0           TX packets:116575 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:13605883 (12.9 MiB)  TX bytes:63269448 (60.3 MiB)           Interrupt:217 Base address:0xc000            eth1 Link encap:Ethernet  HWaddr 00:1B:21:0A:25:AA             inet addr:192.168.1.91  Bcast:192.168.1.255  Mask:255.255.255.0           inet6 addr: fe80::21b:21ff:fe0a:25aa/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:3124648 errors:0 dropped:0 overruns:0 frame:0           TX packets:1693433 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:100            RX bytes:4531121842 (4.2 GiB)  TX bytes:119907573 (114.3 MiB)           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:27294 errors:0 dropped:0 overruns:0 frame:0           TX packets:27294 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:34266420 (32.6 MiB)  TX bytes:34266420 (32.6 MiB)          virbr0 Link encap:Ethernet  HWaddr 00:00:00:00:00:00              inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0            inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:51332 errors:0 dropped:0 overruns:0 frame:0            TX packets:89020 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:0             RX bytes:2916963 (2.7 MiB)  TX bytes:132997389 (126.8 MiB)          vnet0  Link encap:Ethernet  HWaddr FE:52:00:1A:C8:4F              inet6 addr: fe80::fc52:ff:fe1a:c84f/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:25 errors:0 dropped:0 overruns:0 frame:0            TX packets:518 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:500             RX bytes:4226 (4.1 KiB)  TX bytes:51190 (49.9 KiB)      The output of `brctl show`               bridge name bridge id       STP enabled interfaces     br0         8000.001a4d53c3a6       no              vnet0                                                         eth0     virbr0      8000.000000000000       yes      Output from `route`:               Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     192.168.1.0     *               255.255.255.0   U     0      0        0 eth1     192.168.1.0     *               255.255.255.0   U     0      0        0 br0     192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0     169.254.0.0     *               255.255.0.0     U     0      0        0 br0     default         DD-WRT          0.0.0.0         UG    0      0        0 br0      Finally, here's the networking section of the vm I'm trying to configure:               <interface type='bridge'>       <mac address='54:52:00:1a:c8:4f'/>       <source bridge='br0'/>     </interface>


Sum of grep results

I need to output the sum of a grep results for a certain time, for now i hard coded the time grep but any help will be very much appreciated, my problem is i cant output the results on the script. If i use this line, it will give me an output of 1: `cat *.log | egrep '2011-07-01 (04:[0][0-9]:[0-5][1-9]|04:10:00)' * | grep -ach '0110 478655 .. 51' | awk '{SUM += $1} END { print SUM }'` and this line would give me an output of 0 : `cat *.log | egrep '2011-07-01 (04:[1][0-4]:[0-5][1-9]|04:15:00)' * | grep -ach '0110 478655 .. 51' | awk '{SUM += $1} END { print SUM }'` this code needs alot of improvements :               while read line     do     cd $DIR     ta1=`cat *.log | egrep '2011-07-01 (04:[0][0-9]:[0-5][1-9]|04:10:00)' * | grep -ach '0110 478655 ..  51' | awk '{SUM += $1} END { print SUM }'`     ta2=`cat *.log | egrep '2011-07-01 (04:[1][0-4]:[0-5][1-9]|04:15:00)' * | grep -ach '0110 478655 ..  51' | awk '{SUM += $1} END { print SUM }'`     ta=$((ta1 + ta2))     echo -e "Results =  $ta "     done      i wanted to add the results and put it on a while do statement, also i needed two grepping so i can sum up all the instances for a 15min cycle., any idea how to do a single grep statement instead?


Why do /usr and /tmp directories for Linux miss vowels in their spellings?

I have often started to think about this but never found a good answer. Why are these two Unix directories not `/user` and `/temp` instead? All the other directories under `root` seem to be exactly what one would guess them to be, but these two seem odd, I would have always guessed them as `user` and `temp`. Is there some historical reason for the spellings?


Why does ls accept duplicate switches?

I'm curious - is there a difference between `ls -l` and `ls -lllllllllllllllllllllllllllll`? The output appears to be the same and I'm confused on why `ls` allows duplicate switches. Is this a standard practice among most commands?


Detecting a "plug pulled" scenario with Linux

I was wondering if it's possible to detect a shutdown due to power loss on a Linux system. (Power loss defined as: pressing reset button, pressing power button, pulling the power cord) If so, how? (ie, if this is already something that people can do, what commands do I run?) The way I would imagine something like this working:   * When system comes back up, checks for an issued shutdown or reboot command, finds none.   * System checks for any sort of errors that have been logged that would require a reboot, such as kernel panic, etc (OOM maybe?) and finds none.   * If no smoking gun found as described above, the system logs something like "No cause for shutdown found, potential power loss detected."


I can't find tape device file inside /dev directory

I'm using tape storage drive HP LTO3 1x8 auto-loader which is connected to my server running CentOS. it is detected in CentOS correctly. ### cat /proc/scsi/scsi                Host: scsi2 Channel: 00 Id: 01 Lun: 00      Vendor: HP       Model: 1x8 autoloader   Rev: 1.50      Type:   Medium Changer                   ANSI  SCSI revision: 03      ### lsscsi               [1:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0     [2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda     [2:0:1:0]    mediumx HP       1x8 autoloader   1.50  /dev/sch0      _**But the tape device file (`st*` or `nst*`) inside the `/dev` directory has not been created._** I've loaded all the modules               Module                  Size   Used by     sym53c8xx              77039   0      aic7xxx                119025   0      st                     38660  0     autofs4                26888  3     sunrpc                243758  1     ipt_REJECT              2383  2     nf_conntrack_ipv4       9506  2     nf_defrag_ipv4          1483  1 nf_conntrack_ipv4     iptable_filter          2793  1     ip_tables              17831  1 iptable_filter     ip6t_REJECT             4628  2     nf_conntrack_ipv6       8748  2     nf_defrag_ipv6         12182  1 nf_conntrack_ipv6     xt_state                1492  4     nf_conntrack           79453  3 nf_conntrack_ipv4,nf_conntrack_ipv6,xt_state     ip6table_filter         2889  1     ip6_tables             19458  1 ip6table_filter     ipv6                  322029  29 ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6     ppdev                   8729  0     parport_pc             22978  0     parport                37265  2 ppdev,parport_pc     e1000                 167662  0     microcode             112594  0     vmware_balloon          7199  0     ch                     13503  0     i2c_piix4              12608  0     i2c_core               31276  1 i2c_piix4     sg                     30124  0     shpchp                 33482  0     ext4                  364410  3     mbcache                 8144  1 ext4     jbd2                   88738  1 ext4     sd_mod                 39488  4     crc_t10dif              1541  1 sd_mod     sr_mod                 16228  0     cdrom                  39771  1 sr_mod     mptspi                 17051  12     mptscsih               36732  1 mptspi     mptbase                93845  2 mptspi,mptscsih     scsi_transport_spi     26151  3 sym53c8xx,aic7xxx,mptspi     pata_acpi               3701  0     ata_generic             3837  0     ata_piix               22846  0     dm_mirror              14101  0     dm_region_hash         12170  1 dm_mirror     dm_log                 10122  2 dm_mirror,dm_region_hash     dm_mod                 81500  12 dm_mirror,dm_log      ### output of dmesg | grep scsi               scsi0 : ata_piix     scsi1 : ata_piix     scsi 1:0:0:0: CD-ROM            NECVMWar VMware IDE CDR10 1.00 PQ: 0 ANSI: 5     scsi2 : ioc0: LSI53C1030 B0, FwRev=01032920h, Ports=1, MaxQ=128, IRQ=17     scsi 2:0:0:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2     scsi target2:0:0: Beginning Domain Validation     scsi target2:0:0: Domain Validation skipping write tests     scsi target2:0:0: Ending Domain Validation     scsi target2:0:0: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)     scsi 2:0:1:0: Medium Changer    HP       1x8 autoloader   1.50 PQ: 0 ANSI: 3     scsi target2:0:1: Beginning Domain Validation     sr0: scsi3-mmc drive: 1x/1x writer dvd-ram cd/rw xa/form2 cdda tray     sr 1:0:0:0: Attached scsi CD-ROM sr0     scsi: waiting for bus probes to complete ...     scsi target2:0:1: Ending Domain Validation     scsi target2:0:1: FAST-160 WIDE SCSI 320.0 MB/s DT IU RDSTRM RTI WRFLOW PCOMP (6.25 ns,      offset 127)     sr 1:0:0:0: Attached scsi generic sg0 type 5     sd 2:0:0:0: Attached scsi generic sg1 type 0     scsi 2:0:1:0: Attached scsi generic sg2 type 8     ch 2:0:1:0: Attached scsi changer ch0      Does anyone face this issue before and find a solution?


What is qemu-img consistency check?

I would be glad if someone could explain the meaning of `qemu-img check <filename>` command. Man pages provide very poor information about it: > >        check [-f fmt] [-r [leaks | all]] filename >            Perform a consistency check on the disk image filename. >            If "-r" is specified, qemu-img tries to repair any > inconsistencies >            found during the check. "-r leaks" repairs only cluster leaks, >            whereas "-r all" fixes all kinds of errors, with a higher risk of >            choosing the wrong fix or hiding corruption that has already >            occurred. >            Only the formats "qcow2", "qed" and "vdi" support consistency >            checks. >   For instance, can I use this command in case of need to check the hash sum of the disk image (rather hash sums of the files stored on them)?


How to connect tata photon in X window manager in ubuntu 14.04 using command line

Due to some reason I had to shift from Gnome to X(basic X). So here on the desktop nothing appears (no launcher, no menu bar, nothing) but we can open command line in it using `Ctrl`+`Alt`+`Tab`. (I have started X window manager using `startx` from the `tty1`). Applications can be opened using terminal (for example the command Firefox opens the Firefox browser). Now I need to connect to the internet. I have tata photon and I don't know how to connect to the internet using it.   1. If I may know how to open the network manager using command line, I will connect tata photon with it but can it really connect to internet in X.   2. Or else can we connect to internet using command line. If yes then please tell me in detail since I have just shifted to Ubuntu from Windows.


how to run perl cgi script on apache

I Successfully installed Apache web server in my local machine. My question is how to run perl cgi script on this server Actully I don't have any Idea that's why posted question here. my sample cgi script is               #!/perl/bin/perl -w     use strict;     use warnings;     print "Content-type: text/html\n\n";     print "
This is first!
\n";       Where to store this script by which extention either .cgi or .pl? What are the necessary should follow to execute this script . Please let me know I know this is very basic question. I could not found any better link on google so i posted.


Print line after nth occurrence of a match

I am looking to display the line 4598 in the following file. Effectively I want to display the line AFTER the nth occurrence of a match. In this case, the line after the 3rd occurrence of `<Car>`. How do I go about this?               <Car>     10456     </Car>     <Car>     70192     </Car>     <Car>     4598     </Car>