title: Unable to receive data from /dev/ttyACM0 device

text: Using USB based CAN device connected on AR9350 mips processor based Atheros reference board with linux kernel 2.6.32.61. Which is coming up as `/dev/ttyACM0` device. In which Able to transmit data from application to the H/W device, but not able to receive data from the CAN device to the board. Tested this on Fedora12 with linux 2.6.31 kernel where every thing is working fine. Also tested on AR71xx mips based Atheros reference board with linux kernel 2.6.32.61, here also every thing is working fine. # Device entry output: `cat /proc/bus/usb/devices`               T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  5 Spd=12   MxCh= 0     D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 8 #Cfgs=  1     P:  Vendor=04d8 ProdID=00df Rev= 1.01     S:  Manufacturer=Microchip Technology Inc.     S:  Product=MCP2200 USB Serial Port Emulator     S:  SerialNumber=0000472727     C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=100mA     A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=02 Prot=01     I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm     E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=2ms     I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm     E:  Ad=03(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms     E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms     I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)     E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms     E:  Ad=01(O) Atr=03(Int.) MxPS=  16 Ivl=1ms      ### Device terminal settings: Below are the terminal settings used for `/dev/ttyACM0` device on both AR9350 and AR71xx boards,               [root@localhost /root]# stty -a < /dev/ttyACM0     speed 460800 baud; rows 24; columns 80; intr = ^C; quit = ^\; erase =     ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch =     <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;     lnext = ^V; flush = ^O; min = 1; time = 0;     -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts     -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel     -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0     -isig -icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke      ### Main Problem: When we open the device, `acm_rx_tasklet` is getting invoked but the list in acm `filled_read_bufs` is empty. And also `acm_read_bulk` function is not getting called for adding receive buffer into `filled_read_bufs` list. ### Note: Have observed the same problem as mentioned above in AR71xx board and Fedora12 system when baud-rate is other than 460800. ### Debug Log: Below is the debug log with enabling CONFIG_USB_DEBUG option in kernel and DEBUG option in `cdc-acm.c` file. Here `acm_read_bulk` function is not getting called which is needed.               drivers/usb/class/cdc-acm.c: Entering acm_tty_open.     ehci_urb_enqueue:910: LOCAL DEBUG: within PIPE_INTERRUPT     usb 1-1.1: link qh2-0601/83ae1b40 start 1 [1/2 us]     ehci_urb_enqueue:893: LOCAL DEBUG: PIPE_CONTROL     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82cd8200 ep0out len 0, qtd     a38d8ae0  [qh 83ae17c0]     submit_async:1125:MANOJ calling qh_link_async      ath-ehci ath-ehci.0: irq status cc089 Async Periodic FLR INT     ath-ehci ath-ehci.0: ehci_urb_done 1.1 urb 82cd8200 ep0out status 0     len 0/0     drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len:     0x0 result: 0     drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet     acm_rx_tasklet:418:  calling filled read buf list empty. goto urbs     label.     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c300 ep3in len 128, qtd     a38d8b40 [qh (null)]     submit_async:1125:MANOJ calling qh_link_async      drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c300,     rcv 0x83a43b18, buf 0x83a43c58     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c280 ep3in len 128, qtd     a38d8ba0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c280,     rcv 0x83a43b04, buf 0x83a43c44     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c200 ep3in len 128, qtd     a38d8c00 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c200,     rcv 0x83a43af0, buf 0x83a43c30     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c180 ep3in len 128, qtd     a38d8c60 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c180,     rcv 0x83a43adc, buf 0x83a43c1c     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c100 ep3in len 128, qtd     a38d8cc0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c100,     rcv 0x83a43ac8, buf 0x83a43c08     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c080 ep3in len 128, qtd     a38d8d20 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c080,     rcv 0x83a43ab4, buf 0x83a43bf4     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c000 ep3in len 128, qtd     a38d8d80 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c000,     rcv 0x83a43aa0, buf 0x83a43be0     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 82c60700 ep3in len 128, qtd     a38d8de0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60700,     rcv 0x83a43a8c, buf 0x83a43bcc     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0:submit_async 1.1 urb 82c60200 ep3in len 128, qtd     a38d8e40  [qh83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60200,     rcv 0x83a43a78, buf 0x83a43bb8     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390dd80 ep3in len 128, qtd     a38d8ea0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390dd80,     rcv 0x83a43a64, buf 0x83a43ba4     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390d800 ep3in len 128, qtd     a38d8f00 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390d800,     rcv 0x83a43a50, buf 0x83a43b90     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 8390da00 ep3in len 128, qtd     a38d8f60 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390da00,     rcv 0x83a43a3c, buf 0x83a43b7c     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 83a77e80 ep3in len 128, qtd     a2e21000 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x83a77e80,     rcv 0x83a43a28, buf 0x83a43b68     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2f80 ep3in len 128, qtd     a2e21060 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2f80,     rcv 0x83a43a14, buf 0x83a43b54     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2080 ep3in len 128, qtd     a2e210c0 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2080,     rcv 0x83a43a00, buf 0x83a43b40     LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0     ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT     ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2c00 ep3in len 128, qtd     a2e21120 [qh 83ae1bc0]     drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2c00,     rcv 0x83a439ec, buf 0x83a43b2c      ### Help needed: Please suggest some tips to debug this issue. May be some more terminal settings needed to make this working. Not able to understand why only RX is not happening but able to do TX from board to Device.


title: Determine what program is in my MBR code

text: I've done a lot of partitioning / dual booting on my Macbook Pro. Right now I have Mac OS X installed along with Ubuntu 12.04, with Grub installed on the Ubuntu partition. I am wondering - what is the code in my MBR (the first 446 bytes)? Because Macs use EFI and GUID partitioning, the MBR is only a protective/hybrid MBR (in my case, it is a hybrid MBR). **Q: How can I identify what program is in my MBR** (based on its hexdump)? Is there some sort of a signature? **I'm guessing it's grub** but I did a hexdump of it and it didn't match the code I found in this article detailing the Grub MBR ("Stage 1") code. EDIT: I am runnning rEFInd, an EFI bootmanager program. It is an EFI application, and thus resides on my EFI system partition. This program is what runs immediately following bootup, but I do not think it places any code in the 446 bytes of the MBR. EDIT2: I should add that I have had Windows installed for dual-boot as well.


title: How to let networkmanager repeat trying to connect DSL until succeeded?

text: I'm using nm-applet to dial up DSL pppoe connections. As there are a great number of users in my local network, I sometimes have to try many times to establish a successful connection. I wonder is there some way to set nm-applet or network-manager repeat trying automatically until connecting successfully. My system is Gentoo and desktop environment is Gnome.


title: 2 or more programs in same USB serial converter

text: Having a network of lets say 10 devices in RS-485, connected to the linux PC with a RS-485 to USB Converter. Already there is a C program interacting with the serial converter at /dev/ttyUSB0. My question is, What would happen if 2 or more programs interact with the same /dev/ttyUSB0? Will Linux automatically lock /dev/ttyUSB so only one program uses it?


title: Can any shell do argument-level interactive search?

text: Sometimes I need to reuse certain long arguments like paths. If I use history search (`CTRL`+`R`), I may find some command that contains the path, but I still need to delete anything else in the old command, and then move cursor around to write the new command. Worse is that I cannot do this for more than once in a line. I wonder if any shell provides an argument-level history search? Tab-completion that looks into history commands (and arguments) somehow helps. But completion has to match the prefix you type, instead of any substrings.


title: How do I enforce system-wide custom keyboard shortcuts / macros?

text: I would like to be able to apply the same custom key bindings and shortcuts I use on my text editors to my entire desktop environment. I want to basically remap my keyboard system-wide, not just in a specific application window. That is, when I remap `alt + j = Down`, I want pressing `alt + j` to be the same as pressing the "down" key, as far as my desktop environment is concerned. The shortcuts I use are optimised for keeping hands in a natural position close to the home row at all times:               # Note how     # system-wide remapping of *single* keys is possible with xmodmap.     Caps Lock           --> Escape     Escape              --> Caps Lock    # Switch caps lock with                                          # the more useful escape key.                                          # As far as *all* applications                                           # are concerned, pressing caps lock                                           # is actually pressing Escape.           # However, I've not found a good way do the same for multiple keys:     alt + space         --> Right Arrow     alt + Escape        --> Enter     shift + alt + h     --> Backspace     alt + x             --> Delete     shift + alt + l     --> Delete          ctrl + alt          --> Alt           # Default alt functionalities                                            # remapped to ctrl + alt      In my text editor, this has done wonders for my accuracy, speed, and has helped me tremendously with tendon pains I was having, since my hands now barely need to leave their natural resting position. ## First almost-successful attempt at a solution: Using xbindkeys to call up xvkbd (x virtual keyboard). This is a sample from my `.xbindkeysrc`:               # h-j-k-l Movement     ###################         "xvkbd -xsendevent -text "\[Down]""             alt + j              "xvkbd -xsendevent -text "\[Up]""             alt + k              "xvkbd -xsendevent -text "\[Left]""             alt + h              "xvkbd -xsendevent -text "\[Right]""             alt + l      ### Problems: The `alt` key is usually the default key for calling the menu of an application (for example, `alt + F` brings up the *F*ile dropdown menu in most applications). Also, this seems to work with some applications, while others seem to ignore it. xbindkeys isn't really remapping the keyboard, it's just telling xvkbd to send a signal, which can sometimes create conflicts with the active application (unlike xmodmap, which truly remaps the keyboard). ## Goal A system-wide remapping of my keyboard, implemented in a way that is easily portable (an rc file or something similar). `alt` is the optimal key of choice, since `ctrl` is heavily used across applications, and the mod key is taken up by my windows manager (Xmonad). ## My setup I'm running Ubuntu 12.10, with the Xmonad desktop environment. * * * Is this doable? I don't yet know much about OS-level stuff and how it processes input.


title: su: Permission denied despite correct password

text: In my new Gentoo installation, su doesn't work as my non-root user: After entering the correct password I get the message "su: Permission denied". What could be causing this? I have already tried reinstalling the package containng `/bin/su`. EDIT: sudo works.


title: Gmake macro expansion: macro calls macro with variable in arguments

text: In the following makeffile one macro process it's arguments to call another macro. I expect that makefile below will generate two targets and correct list of the targets in $TARGETS. But in fact it only generates one target with correct list. How to do such macro call in correct way?               all: $TARGETS     define f2     .PHONY: target$(1)     target$(1):         echo "We are in $(1)"     TARGETS+=target$(1)     endef          define f1     VAR$(1)=ValueWith$(1)     $(eval $(call f2,$$(VAR$(1))))     endef          $(eval $(call f1,CallOne))     $(eval $(call f1,CallTwo))          $(warning Warning: $(TARGETS))      output of make:               test.mk:16: warning: overriding recipe for target `target'     test.mk:15: warning: ignoring old recipe for target `target'     test.mk:18: Warning: targetValueWithCallOne targetValueWithCallTwo     gmake: Nothing to be done for `all'.


title: How to acquire image of disk on Linux computer?

text: Pertaining to computer forensics, if the suspect's computer (which cannot be removed from the scene), is Linux, can you directly use tools such as _dd_ or _dcfldd_ on his computer to acquire the disk image? Or do you need to use forensic live cds like Helix, Penguin sleuth or FFCU on top of the existing OS?


title: How to specify additional parameters for GNU sort's --compress-program option?

text: `sort --compress-program=/bin/gzip` works fine, but how can I pass options down to the compression programm (e.g. `\--best` or `\--fast`)? `sort --compress-program=/bin/gzip\ --best` failes with the error message > couldn't execute compress program as do `sort --compress-program="/bin/gzip --best"` and `sort --compress- program=/bin/gzip\\\\\ --best` (as a desperate guess). Google-ing the error returned nothing but the source code generating the message. Is there any way to do this without writing a wrapper or defining an alias?


title: iptables forward all traffic to interface

text: I have two interfaces `eth1` and `eth0`. I want all traffic on `eth0`to be forwarded to `eth1`. I created an iptable rule like this:               iptables -A FORWARD -s 0/0 -i eth0 -p tcp -o eth1 -j ACCEPT      But this doesn't work. Is this the correct way of doing this?


title: Enable second monitor from shell

text: So... I have two monitors on my Ubuntu machine. And every time I launch some Windows OpenGL application under Wine it turns off the second monitor. And leaves it turned off when the application exits. I wonder, is there a shell command which will instantly turn the second monitor on?


title: Camera to check if I'm watching the computer?

text: Is there a program to do following: I have a webcam on my laptop. I would like that my computer starts a screensaver if I'm not watching my laptop and stop the saver when I'm watching the screen. Is there a program for reading the webcam? I'm using Ubuntu 14.04.


title: tcpdump and nc with udp

text: I don't understand the behaviour of netcat. Let's say that I have one host acting as server:               [root@localhost tmp]# nc -u -l -p 670      Then I try to connect from a client:               root@debian:/tmp#  nc   -u   192.168.0.109 670      Meanwhile I try to capture those packages:               [root@localhost sergio]# tcpdump -nn -i wlp7s0 port 670      I see no packets at all, only when I issue something like:               root@debian:/tmp#  echo "Hola Mundo" | nc   -u   192.168.0.109 670          [root@localhost sergio]# tcpdump -nn -i wlp7s0 port 670     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on wlp7s0, link-type EN10MB (Ethernet), capture size 65535 bytes     01:37:39.425276 IP 192.168.0.114.44287 > 192.168.0.109.670: UDP, length 12      I wonder if is it the proper behaviour of netcat. Why is the reason why it's not seen any packets except when I send something from stdin?


title: Use encrypted /home in fresh Debian created in Mint

text: I usually use my Linux Mint 15 installation on my PC. I have separate `/` and `/home` partitions. `/home` is encrypted with ecryptfs, which I did not configure myself, I just ticked the "encrypt home" when installing Mint. I have today installed Debian, with it's own `/`-partition. I also chose the same `/home` partition I use on Mint, because I want to share all files in `/home` between the two. I was hoping that Debian would automatically recognize `/home` as encrypted with ecryptfs and decrypt it for me with my user password. But it did not. When I log in on Debian I get this error message:               Could not update ICEauthority file /home/fridge/.ICEauthority.      My only option is to log out. The `/etc/fstab` entry in Mint does not mention `ecryptfs` anywhere, `/home` is just mounted as `ext4`. That was my first thought, that it would mount in `fstab`. How do I configure Debian to automatically decrypt `/home` for me when I log in? * * * **EDIT:** I belive I misunderstood the problem! Today I started up Debian and instead of logging in through the greeter I pressed Ctrl+Alt+F2 and logged in through the command line. The `/home` partition was decrypted! Apparently Debian does that for you like Mint. I tried `startx` but encountered the same problem as I was logging in through the GUI `xauth: timeout in locking authority file /home/fridge/.Xauthority`. Should I close this question now?


title: Graphical Btrfs tool

text: Is there a graphical tool for creating Btrfs sub-partitions and in particular, subpartitions like "GParted" or "system-config-lvm"? I'm running Debian squeeze. In response to the first comment, Btrfs can do thinks like RAID and sub- partitions, much like LVM. I've read that Btrfs can be seen as a replacement for LVM. LVM has a graphical tool to manage these aspects, does Btrfs have the same?


title: Can't install "libdvdcss" with yum anymore after update on "Fedora 20 Heisenburg"

text: I couldn't update my system today, because of dependency problems with `libdvdcss`, I removed `libdvdcss` and it's dependency `libdvdcss2`. Update was successfull after that but now I can't install `libdvdcss` back, because it's not in the repositories.               Dependencies Resolved          ===================================================================================      Package             Arch            Version                Repository        Size     ===================================================================================     Removing:      libdvdcss2          x86_64          1.2.13-7.fc20          @atrpms           34 k     Removing for dependencies:      libdvdcss           x86_64          1.2.13-7.fc20          @atrpms           98 k          Transaction Summary     ===================================================================================     Remove  1 Package (+1 Dependent package)      .....................................................................................................................................................................               ~]$ sudo yum install libdvdcss     .......          No package libdvdcss available.     Error: Nothing to do      ....................................................................................................................................................................               ~]$ sudo yum repolist     [sudo] password for user:      Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks, refresh-                   : packagekit, versionlock     Loading mirror speeds from cached hostfile      * fedora: www.fedora.is      * fedora-debuginfo: www.fedora.is      * rpmfusion-free: www.fedora.is      * rpmfusion-free-debuginfo: www.fedora.is      * rpmfusion-free-updates: www.fedora.is      * rpmfusion-free-updates-debuginfo: www.fedora.is      * rpmfusion-nonfree: www.fedora.is      * rpmfusion-nonfree-debuginfo: www.fedora.is      * rpmfusion-nonfree-updates: www.fedora.is      * rpmfusion-nonfree-updates-debuginfo: www.fedora.is      * updates: www.fedora.is      * updates-debuginfo: www.fedora.is     repo id                                       repo name                      status     adobe-linux-i386                              Adobe Systems Incorporated          2     adobe-linux-x86_64                            Adobe Systems Incorporated          2     fedora/20/x86_64                              Fedora 20 - x86_64             38,597     fedora-debuginfo/20/x86_64                    Fedora 20 - x86_64 - Debug      6,881     home_tpokorra_mono                            mono and monodevelop (Fedora_2     89     mysql-connectors-community/20/x86_64          MySQL Connectors Community         13     mysql-tools-community/20/x86_64               MySQL Tools Community              10     mysql56-community/20/x86_64                   MySQL 5.6 Community Server         73     rpmfusion-free/20/x86_64                      RPM Fusion for Fedora 20 - Fre    468     rpmfusion-free-debuginfo/20/x86_64            RPM Fusion for Fedora 20 - Fre    166     rpmfusion-free-updates/20/x86_64              RPM Fusion for Fedora 20 - Fre    402     rpmfusion-free-updates-debuginfo/20/x86_64    RPM Fusion for Fedora 20 - Fre    132     rpmfusion-nonfree/20/x86_64                   RPM Fusion for Fedora 20 - Non    203     rpmfusion-nonfree-debuginfo/20/x86_64         RPM Fusion for Fedora 20 - Non     60     rpmfusion-nonfree-updates/20/x86_64           RPM Fusion for Fedora 20 - Non    288     rpmfusion-nonfree-updates-debuginfo/20/x86_64 RPM Fusion for Fedora 20 - Non    113     tor/x86_64                                    Tor experimental repo               2     tor-source                                    Tor experimental source repo        0     updates/20/x86_64                             Fedora 20 - x86_64 - Updates   18,678     updates-debuginfo/20/x86_64                   Fedora 20 - x86_64 - Updates -  2,405     virtualbox/20/x86_64                          Fedora 20 - x86_64 - VirtualBo      9      From rpmfind.net link: > libdvdcss is a simple library designed for accessing DVDs as a block device > without having to bother about the decryption. What has happened? Do I lose the ability to play dvd's for some time or have they changed something so it comes from somewhere else? EDIT: It seems that I originally installed it with `yum` from the `atrpms` repository following this guide. I thought it should have been standard for `rpmfusion` but it didn't come from there.


title: Why would the "real" time be much higher than the "user" and "sys" times combined?

text: I execute and `time` many commands (i.e. `nslookup`) through `SSH` and I collect the total time needed for the implied service to complete (i.e. **DNS** ). So I collect the `user` and `sys` time as the `real` time counts time when my process is blocking which I do not need...I guess. But some of my tests had results as such:               real 3m22.033s     user 0m0.009s     sys 0m0.014s      I execute these tests on limited resources linux boxes but still, the `real` time is significantly high. Would this only indicate that the box is VERY busy running different processes ? Is it still correct to add up the `user` and `sys` times to know how much the service took ?


title: How to pass arguments to 'source' command?

text: My `source` command in the CShell goes like this :               source /directory/of/script/script.csh      The `script.csh` executes and in between, waits for my password to confirm the identity. I am tired of typing the password everytime I have to `source`. So, since my password is constant, I was thinking of creating an alias which goes like this :               alias <alias name> 'source /directory/of/script/script.csh; <my password>'      The only catch is that, it is not taking in my password because, technically, `my password` is executed after the complete execution of the `source`. How do I go about it? If anyone needs any further info, I am happy to provide. * * * EDIT: The original `script.csh` CAN NOT be modified to exclude the password because, I am not authorised to make such changes. * * * EDIT (2) : The actual need is to pass on a value (a particular number, depending on what I am about to do after this) to the shell script `script.csh` while it is being executed, without user intervention. I used the word 'password' because, it was easier to explain using that example as authentication is some thing that is usually asked repeatedly _in between_ a process, every time one tries something, and the execution does **not** proceed without it, or stops if a wrong input is given.. And, my case is synonymous : I have to give an input for the script to proceed, and it halts if a wrong input is given.


title: How to record a flash movie from a live cam on the Internet?

text: I am watching some webcams live from the Internet, showing some big cities around the world. I'd like to record some to show to my friends at home. Is it possible?


title: How to limit ssh access for localhost only?

text: I need to forbid ssh access (except localhost) for specified user. So. `ssh localhost` should work. `ssh hostname` from outside should not work for that user. All other users should work as usual.


title: Partition /usr/local : Can I use the software there after reinstall?

text: I want to reinstall Linux OS, and before that, I think I will partition my hard disk again. (I just use a simple one partition `/` for root, and make Linux automatically put all other directories there). I often save software installations in `/usr/local`. So, my question is: suppose I create a new partition, `/usr/local`, and save data there; if I reinstall Linux again, can I continue to use this software and not need to install again? I'm new to Linux World, so I'm not sure of these things.


title: How to configure Exim to forward all incoming mail to new server?

text: I am moving servers, both of them running Debian (oldstable and stable). Both are running Exim4. When I switch the DNS entries over to the new server, I'd like the old server to still forward incoming mail to my new server for processing, so that users do not see any outage. How can I do this?


title: RAID5 recovery trying with "mdadm --create ... missing"

text: First how I got in this situation: I had an RAID5 array with disks each 2TB (external USB-disks), I then wanted to create a larger encrypted array. Therefore I got 2 additional disks (also 2 TB each) and the plan was to run the original array in degraded mode, set up the new encrypted array, copy part of the data, after that shrink the original array to 2 disks degraded mode, enlarge the new one, copy the rest of the data and finally enlarge it to 7 disks RAID5 non-degraded. I did the whole procedure with `/dev/loopX` devices 2GB each to test if my plan has any caveats. Everything went well with the real array until to the point where one of the new disks failed. When I replaced this one, the order in which the disks are recognized by the kernel changed after the next reboot (`/dev/sdb`, `/dev/sdc`, ... were all different disks than before). Everything got messed up and I didn't realize that until one of the disks got resynched as member of the wrong array. I spare the details of this story and get straight to the point: I have now one encrypted array, 3-disk RAID5, degraded on `/dev/sdc1` and `/dev/sdd1`, running perfectly fine, all data there and a healthy file system according to `fsck -f`. So far so good. The whole problem is now down to 3 disks - I can't get this non-encrypted array to work again. I am pretty sure the data _HAS_ to be there on `/dev/sdf1`, `/dev/sdg1`, `/dev/sdh1`, as this was a working array just before ONE of the disks might got messed up (accidentally got resynched as member of the other encrypted array, as said before). So, one of these three disks may have incorrect array data, but which one? And two of them have to be good, but how do I figure that out? I tried every permutation of `mdadm --create` ... with `/dev/sdf1`, `/dev/sdg1`, `/dev/sdh1` and "missing" like:               mdadm --create /dev/md0 --level=5 --raid-devices=3  /dev/sdf1 /dev/sdg1 missing          mdadm --create /dev/md0 --level=5 --raid-devices=3  /dev/sdf1 missing /dev/sdg1          ... and of course checked every time with `fsck /dev/md0` which complained about an invalid superblock. Every time mdadm created the array, but there was no file system readable, it just contained garbage, none of the permutations used with mdadm finally worked. So my question is now: What options do I have left? Besides lose my data and rebuild the array from scratch, of course. Here some additional info (all the disks):               mdadm --examine /dev/sdb1     /dev/sdb1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : cfee26c0:414eee94:e470810c:17141589                Name : merlin:0  (local to host merlin)       Creation Time : Sun Oct 28 11:38:32 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3906760704 (1862.89 GiB 2000.26 GB)          Array Size : 3906759680 (3725.78 GiB 4000.52 GB)       Used Dev Size : 3906759680 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : f4f0753e:56b8d6a5:84ec2ce8:dbc933f0              Update Time : Sun Oct 28 11:38:32 2012            Checksum : 60093b72 - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AA. ('A' == active, '.' == missing)               mdadm --examine /dev/sdc1     /dev/sdc1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 5cb45bae:7a4843ba:4ad7dbfb:5c129d2a                Name : merlin:1  (local to host merlin)       Creation Time : Wed Sep 26 07:32:32 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3906760704 (1862.89 GiB 2000.26 GB)          Array Size : 3905299456 (3724.38 GiB 3999.03 GB)       Used Dev Size : 3905299456 (1862.19 GiB 1999.51 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 9e2f9ae6:6c95d05e:8d83970b:f1308de0              Update Time : Fri Oct 26 03:26:37 2012            Checksum : 79d4964b - correct              Events : 220                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 0        Array State : AA. ('A' == active, '.' == missing)               mdadm --examine /dev/sdd1     /dev/sdd1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 5cb45bae:7a4843ba:4ad7dbfb:5c129d2a                Name : merlin:1  (local to host merlin)       Creation Time : Wed Sep 26 07:32:32 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3906760704 (1862.89 GiB 2000.26 GB)          Array Size : 3905299456 (3724.38 GiB 3999.03 GB)       Used Dev Size : 3905299456 (1862.19 GiB 1999.51 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 98b07c41:ff4bea98:2a765a6b:63d820e0              Update Time : Fri Oct 26 03:26:37 2012            Checksum : 6e2767e8 - correct              Events : 220                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AA. ('A' == active, '.' == missing)               mdadm --examine /dev/sde1     /dev/sde1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 6db9959d:3cdd4bc3:32a241ad:a9f37a0c                Name : merlin:0  (local to host merlin)       Creation Time : Sun Oct 28 12:12:59 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3905299943 (1862.19 GiB 1999.51 GB)          Array Size : 3905299456 (3724.38 GiB 3999.03 GB)       Used Dev Size : 3905299456 (1862.19 GiB 1999.51 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 677a4410:8931e239:2c789f83:e130e6f7              Update Time : Sun Oct 28 12:12:59 2012            Checksum : 98cb1950 - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 2        Array State : A.A ('A' == active, '.' == missing)               mdadm --examine /dev/sdf1     /dev/sdf1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 3700a0a6:3fadfd73:bc74b618:a5526767                Name : merlin:0  (local to host merlin)       Creation Time : Sun Oct 28 11:28:30 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3905392640 (1862.24 GiB 1999.56 GB)          Array Size : 3905391616 (3724.47 GiB 3999.12 GB)       Used Dev Size : 3905391616 (1862.24 GiB 1999.56 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 5a8a5423:10b7a542:26b5e2b3:f0887121              Update Time : Sun Oct 28 11:28:30 2012            Checksum : 8e90495f - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AA. ('A' == active, '.' == missing)               mdadm --examine /dev/sdg1     /dev/sdg1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 202255c9:786f474d:ba928527:68425dd6                Name : merlin:0  (local to host merlin)       Creation Time : Sun Oct 28 11:24:36 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3905299943 (1862.19 GiB 1999.51 GB)          Array Size : 3905299456 (3724.38 GiB 3999.03 GB)       Used Dev Size : 3905299456 (1862.19 GiB 1999.51 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 4605c729:c290febb:92901971:9a3ed814              Update Time : Sun Oct 28 11:24:36 2012            Checksum : 38ba4d0a - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AA. ('A' == active, '.' == missing)               mdadm --examine /dev/sdh1     /dev/sdh1:               Magic : a92b4efc             Version : 1.2         Feature Map : 0x0          Array UUID : 682356f5:da2c442e:7bfc85f7:53aa9ea7                Name : merlin:0  (local to host merlin)       Creation Time : Sun Oct 28 12:13:44 2012          Raid Level : raid5        Raid Devices : 3           Avail Dev Size : 3906761858 (1862.89 GiB 2000.26 GB)          Array Size : 3906760704 (3725.78 GiB 4000.52 GB)       Used Dev Size : 3906760704 (1862.89 GiB 2000.26 GB)         Data Offset : 262144 sectors        Super Offset : 8 sectors               State : clean         Device UUID : 489943b3:d5e35022:f52c917a:9ca6ff2a              Update Time : Sun Oct 28 12:13:44 2012            Checksum : f6947a7d - correct              Events : 0                   Layout : left-symmetric          Chunk Size : 512K             Device Role : Active device 1        Array State : AA. ('A' == active, '.' == missing)                    cat /proc/mdstat      Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]      md1 : active raid5 sdc1[0] sdd1[1]           3905299456 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]          unused devices: <none>      Any help would be greatly appreciated!


title: Cut a string- Catch: There is file with same name as string in the same path

text: Input               /in/archive/ABC/20140111_ABC_018_PART_001.dat      Desired Output:               20140111_ABC_018_PART_001.dat      Command used:               cut -d/ -f4 "/1a/ftproot/archive/ABC/20140111_PR1_018_SALESDOC_ITEM_001.dat"      Problem: Its actually opening the file `20140111_ABC_018_SALESDOC_ITEM_018.dat` in the path `/1a/ftproot/archive/ABC/` and displaying the result from file.


title: Inhibit Variable Expansion in Paths

text: How do I prevent Zshell (and Bash I assume) from expanding environment variables in paths be completed as shown in the following example:               $PREFIX/alt/li      should expand to               $PREFIX/alt/lib      and not to say               /opt/alt/lib


title: Vim multiple windows / hide

text: If I had x or more windows open in a VIM session and I wanted to quickly hide all but the active one for a moment then return the windows to the layout I had them int how would I do it?


title: VIM: show all lines edited in session

text: Is there a command or plugin that I can use to show all the lines I have edited in a Vim session? I would like to be able to have all the changes I have made highlighted when working in co-workers projects and lost in lines of code.


title: Bash error message on a mac using Perl

text: I'm trying to run basic functions on Perl (Mac) but I get the same error message all the time. I managed to run programs like the simple 'hello, world' example. They work fine:               $ perl -w hello.pl     Hello World      But when I try different things, such as assigning a value to a variable, it gives me a message such as:               $number = 13*2;     -bash: =: command not found      Commands such as list seem to work, but I get the bash error all the time. I read that it can be related to the path but not sure how to exactly verify this and what's the bash doing here.


title: tc don't see marked with -j MARK packets

text: Server has 2 network interfaces:   * eth1 with address 13.0.0.254/24   * eth0 with address 172.20.203.4/24. It's routing traffic between this two networks. Task is to limit bandwidth between this two networks to 1Vbit/sec, but not to limit bandwidth between server and network hosts(i. e. limit all packets going though FORWARD)               iptables -t mangle -A POSTROUTING -s 13.0.0.0/24 -d 172.20.203.0/24 -j MARK --set-mark 0x0001     iptables -t mangle -A POSTROUTING -s 172.20.203.0/24 -d 13.0.0.0/24 -j MARK --set-mark 0x0002          # eth1     tc qdisc add dev eth1 root handle 1:0 htb default 2          tc class add dev eth1 parent 1:0 classid 1:1 htb rate 1000mbps ceil 1000mbps     tc class add dev eth1 parent 1:1 classid 1:2 htb rate 999mbps ceil 1000mbps     tc class add dev eth1 parent 1:1 classid 1:3 htb rate 1mbps          tc qdisc add dev eth1 parent 1:2 handle 2:0 sfq perturb 10     tc qdisc add dev eth1 parent 1:3 handle 3:0 sfq perturb 10          tc filter add dev eth1 parent 1:0 handle 1 fw flowid 1:3     tc filter add dev eth1 parent 1:0 handle 2 fw flowid 1:3          # eth0     tc qdisc add dev eth0 root handle 1:0 htb default 2          tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1000mbps ceil 1000mbps     tc class add dev eth0 parent 1:1 classid 1:2 htb rate 999mbps ceil 1000mbps     tc class add dev eth0 parent 1:1 classid 1:3 htb rate 1mbps          tc qdisc add dev eth0 parent 1:2 handle 2:0 sfq perturb 10     tc qdisc add dev eth0 parent 1:3 handle 3:0 sfq perturb 10          tc filter add dev eth0 parent 1:0 handle 2 fw flowid 1:3     tc filter add dev eth0 parent 1:0 handle 1 fw flowid 1:3      This doesn't work. If I use this at the beginning:               tc qdisc add dev eth1 root handle 1:0 htb default 3     tc qdisc add dev eth0 root handle 1:0 htb default 3      it works. So problem is in filter settings.               iptables -L -v -n -t mangle      shows, that packets are going though MARK rules. I tried to mark packets not in POSTROUTING, but in FORWARD or PREROUTING - this does not work too. What am I doing wrong? Here is some diagnostics:               # tc -s -d -r filter show dev eth0     filter parent 1: protocol [768] pref 49151 fw     filter parent 1: protocol [768] pref 49151 fw handle 0x1 classid 1:3     filter parent 1: protocol [768] pref 49152 fw     filter parent 1: protocol [768] pref 49152 fw handle 0x2 classid 1:3     # tc -s -d -r filter show dev eth1     filter parent 1: protocol [768] pref 49151 fw     filter parent 1: protocol [768] pref 49151 fw handle 0x2 classid 1:3     filter parent 1: protocol [768] pref 49152 fw     filter parent 1: protocol [768] pref 49152 fw handle 0x1 classid 1:3      Kernel config:               /boot # uname -a     Linux armada-sc-02 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux     /boot # grep CONFIG_IP_MULTIPLE_TABLES config-2.6.32-5-amd64     CONFIG_IP_MULTIPLE_TABLES=y     /boot # grep CONFIG_IP_ADVANCED_ROUTER config-2.6.32-5-amd64     CONFIG_IP_ADVANCED_ROUTER=y     /boot # grep CONFIG_IP_ROUTE_FWMARK config-2.6.32-5-amd64


title: Debian Wheezy installation with preseed

text: I have a USB stick with netinst version of Debian Wheezy (testing). I am trying to load a preseed file, named "preseed.cfg" in the USB root folder (same folder as initrd.gz). I use GRUB and my entry looks like this:               menuentry 'Debian Wheezy automatic install' {       linux /vmlinuz preseed/file=/hd-media/preseed.cfg auto=true priority=critical       initrd /initrd.gz     }      Now everytime the installer starts it says `cannot find file:///hd- media/preseed.cfg. Will continue with manual install"`. Do I have the wrong syntax? Also, I thought any file named "preseed.cfg" will be detected automatically.


title: How to vgscan in RHEL 5.8 rescue mode?

text: I want to increase the journaling size of an EXT3 FS: /var. I booted up a RHEL 5.8 DVD, and tried the "linux rescue" mode. The problem is that the original install that has the mentioned /var FS is in a vg/lvm. So I tried the command:               vgscan      as ex.: this howto states it: http://www.linuxtopia.org/online_books/rhel6/rhel_6_installation/rhel_6_installation_ap- rescuemode.html but the vgscan binary is not found. I tried to find it with "find / -name vgscan", but it didn't find it. **Q: What am I missing? Isn't the rescue mode for RESCUING??**


title: less is always case-insensitive

text: Trying to find out how to use case-insensitive searches in `less` I found this on serverfault. That seems to perfectly answer my question. The problem is: It doesn't work like that here (openSUSE 13.1; less 458). I had aliased `less` to `less -WiNS` but I changed that. But even calling it as `command less file` does not change anything. I have checked with `ps` that there is no `-i` option in the command line any more. As the answer says the `less` help (pressing `h`) states that I can use `-i` within `less`, too. If I use that once then `less` tells me it had changed to case-insensitive search (that is kind of correct: nothing changes). If I use it twice then `less` tells me it had turned to case-sensitive search. And right, then it works as it should from the start. Giving `-i` twice on the command line does not work, though. What's up here?


title: How to re-install syslinux on a re-formatted (fat32 to fat16) partition

text: I wrote an `.img` file containing a custom debian distro to a USB stick via win32diskimager program. The stick doesn't boot on my older motherboard, returning: > SYSLINUX: No DEFAULT or UI configuration directive found I learned that it's because my motherboard doesn't recognize FAT32 partitions. It will only boot from a FAT16 partition. Sadly win32diskimager creates a FAT32 partition by default and there are no means to configure it. ![usb stick after writing .img by win32diskimager](http://i.stack.imgur.com/fNzY8.png) ![usb stick fat32 partition content](http://i.stack.imgur.com/GwWLm.png) I found a workaround by someone who wrote: > I've managed to recreate with fat16 filesystem, by reformatting the 525MB > partition, copying over the files and reinstalling syslinux (latest version, > 4.05) - and now it boots. It looks like indeed some motherboards have issues > booting from fat32 USB sticks. I have followed the workaround and done this:   * Made a copy of all the contents of the fat32 partition   * Unmounted and formatted the fat32 partition to fat16 via gparted (at this point the new fat16 partition is not marked as boot in the flags column)   * Copied the contents back to the newly created fat16 partition Unfortunately I do not know how to reinstall syslinux on the USB stick so that it boots. I've got syslinux available (`syslinux --version` => `4.05`) from the command line but have no idea what to do with it.


title: What is the process `sendmail`?

text: When I type `top` commond, I see many `sendmail`, what are these `sendmail`? I never set mail in my service.               SER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND     16110 root      17   0  234m  35m 8380 R 45.3  1.7   0:02.53 php     16101 root      17   0  230m  31m 8100 R 43.3  1.5   0:02.06 php     16092 root      15   0  219m  20m 8100 S 21.0  1.0   0:01.32 php     16104 root      15   0  226m  26m 8096 S 13.6  1.3   0:01.64 php     16107 root      16   0  215m  16m 8080 R  5.3  0.8   0:00.21 php     16096 root      15   0  216m  18m 8088 S  2.7  0.9   0:00.71 php     16122 smmsp     18   0 76032 4380 2904 S  1.7  0.2   0:00.07 sendmail     16125 smmsp     18   0 76024 4368 2904 S  1.7  0.2   0:00.06 sendmail     16137 root      17   0 80976 3836 1388 R  1.3  0.2   0:00.04 sendmail     16099 root      18   0 39100 1672  924 R  1.0  0.1   0:00.03 crond     16108 root      18   0 39100 1672  924 R  1.0  0.1   0:00.04 crond     16060 root      15   0 15004 1288  992 R  0.3  0.1   0:00.05 top     16091 root      18   0 39100 1672  924 S  0.3  0.1   0:00.02 crond     16095 root      18   0 39100 1672  924 S  0.3  0.1   0:00.01 crond     16102 root      18   0 39100 1672  924 S  0.3  0.1   0:00.03 crond     16116 smmsp     18   0 76024 4364 2904 S  0.3  0.2   0:00.02 sendmail     16117 smmsp     18   0 76024 4364 2904 S  0.3  0.2   0:00.02 sendmail


title: MP3 tags Cyrillic chars

text: I have some `mp3` files with Cyrillic chars on file names and also on their tags. I'm using `audacious` to play them. See the file info below: ![enter image description here](http://i.stack.imgur.com/thlJo.png) Is it possible to change some encoding to show the contents correctly? **Âûñîêî** should be **Высоко** , I guess.


title: Tool in UNIX to subtract dates

text: Is there any tool in Solaris UNIX (so no GNU tool available) to subtract dates? I know that in Linux we have gawk that can subtract one date from another. But in Solaris the maximum we have is nawk (improved awk) which cannot perform date calculations. Also I cannot use perl... :( Is there anyway to do dates calculations like `20100909-20001010` ? UPDATE: Is `bc` able to perform dates calculations? Thanks guys


title: Why's my Evolution setup screen blank?

text: Trying to run Evolution on openSuSE 12.1 without success. It starts up (eventually, super slow even on this pretty beefy box) and gives me a window with "Evolution Setup Assistant" on the title bar and 2 buttons at the bottom right (one has a stop sign and the other a couple dots and an arrow). No text anywhere else on the window. Clicking the forward button just gives me another broken window with 3 buttons a check box and no text describing anything. Is there some component I'm missing that enable Evolution to display text so I can set it up?


title: How do associative arrays work?

text: bash-3.00# cat iplogs.txt     180607 093423   123.12.23.122  133     180607 121234   125.25.45.221  153     190607 084849   202.178.23.4   44     190607 084859   164.78.22.64   12     200607 012312   202.188.3.2    13     210607 084849   202.178.23.4   34     210607 121435   202.178.23.4   32     210607 132423   202.188.3.2    167          bash-3.00# awk '{ip[$3]++;} END{for (var in ip)\     print var, "access", ip[var]," times"}' iplogs.txt     202.188.3.2 access 2  times     164.78.22.64 access 1  times     202.178.23.4 access 3  times     125.25.45.221 access 1  times     123.12.23.122 access 1  time      The above output is unclear to me. How is `$3` is incremented for every repeated value? I expected that values assigned to array `ip` would be like:               ip[123.12.23.122]=0     ip[125.25.45.221]=1      and so on. So I tried this, but the value of array `ip[var]` did not get printed.               bash-3.00# awk '{ip[$3]++;} END{for (var=0;var <= NR; var++)\     print var, ip[var]}' iplogs.txt     0     1     2     3     4     5     6     7     8


title: Add a file to a different path in a zip file

text: I have a file that placed in the following directory:               folder_A/another_folder_A/file_to_add.xml      Now, what I want to do is simply add the file to a folder in an existing zip archive. For example this is my zip content:               my_zip.zip/folder_B/another_folder_B      How can I add the `file_to_add.xml` to the `another_folder_B`?               my_zip.zip/folder_B/another_folder_B/file_to_add.xml      I don't want to create folders with the same names and add them. Is there a command that allow me to do that?


title: What RPMs do I need for timeconfig?

text: I've got `setuptools` set up and have read through the list of what's in `/etc/setuptools.d` I'm interested in installing `timeconfig` as well, but I only need the TUI version (no GUI). Which RPMs do I need? (I'll be including these RPMs in a CentOS ISO installation)


title: Getting Ubuntu working with eSATA (Intel H57 chipset)

text: Does anyone know if there's kernel support for the eSATA controller in the Intel H57 chipset, or if there's a driver for it somewhere? _(Full disclosure:Asked over on SuperUser.com, no luck, but as this is more of a *nix-oriented place...)_ I'm just having no luck getting my Ubuntu 10.04 LTS desktop (64-bit) to recognise a drive in an eSATA enclosure. It works fine if I use the same enclosure via its USB2 connector instead, which tells me that the drive is installed in the enclosure successfully and that the drive works. Here's what I've tried / checked:   1. Connecting the drive naively. Literally, plugging the eSATA cable into the box and turning the drive on, while Ubuntu was running. No reaction, and nothing shows up in the Disk Uility or `fdisk -l`.   2. Leaving the drive connected and cold booting Ubuntu (literally from poweroff). Still nothing on DU or `fdisk -l`.   3. Ensuring that the BIOS has the eSATA port enabled (it did, I didn't have to change it).   4. Ensuring that the BIOS is using AHCI. It wasn't, and that hadn't been any problem accessing the internal SATA SSD (the box's primary drive). (The SSD showed up under the PATA controller, because I think the BIOS was doing emulation or something.) Switching the BIOS to use AHCI on the SATA controller didn't make any difference other than that the SSD showed up under the SATA controller instead and was listed as using the ahci driver, as you'd expect.   5. Looking in `dmesg` for anything useful. I don't see any mention of the drive at all (except from when I had it attached via USB). Other info:   * eSATA is on the motherboard, an Intel DH57JG, which uses the Intel H57 chipset.   * Enclosure is an Apex (cheap, but other than cable length issues people on Amazon seemed to like it, and it's handsome).   * Drive is a Samsung F3 HD103SJ.   * Cable is, well, a cable.   * Intel doesn't seem to have any specific Linux drivers for the board (Ubuntu or Linux aren't even _categories_ here, for instance), they just list that the chipset is supported "native." But as they don't call out eSATA specifically, that could mean anything. Unfortunately, I don't have any other machine that supports eSATA so I can do the obvious thing and prove that the rig (enclosure and cable) work over eSATA on another box. :-( And I don't have my desktop set up to dual-boot another OS... So at this stage, I don't know it's a software problem, could be hardware, could be cable, but the Ubuntu-oriented vendor I bought it from says they don't know how to get it working either (not that they mentioned that on their product page!), so... **Update** : Someone over on the Ubuntu forums suggested installing scsitools and running `rescan-scsi-bus.sh` as root, just in case. No luck, but posting that info here for completeness:               root@forge:~# rescan-scsi-bus.sh -c     Host adapter 0 (ahci) found.     Host adapter 1 (ahci) found.     Host adapter 2 (ahci) found.     Host adapter 3 (ahci) found.     Host adapter 4 (ahci) found.     Host adapter 5 (ahci) found.     Scanning SCSI subsystem for new devices     Scanning host 0 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     Scanning for device 0 0 0 0 ...     OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00           Vendor: ATA      Model: INTEL SSDSA2M080 Rev: 2CV1           Type:   Direct-Access                    ANSI SCSI revision: 05     Scanning host 1 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     Scanning host 2 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     Scanning for device 2 0 0 0 ...     OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00           Vendor: TSSTcorp Model: CDDVDW SN-S083C  Rev: SB01           Type:   CD-ROM                           ANSI SCSI revision: 05     Report Luns command not supported (support mandatory in SPC-3)     Scanning for device 2 0 0 0 ...     OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00           Vendor: TSSTcorp Model: CDDVDW SN-S083C  Rev: SB01           Type:   CD-ROM                           ANSI SCSI revision: 05     Scanning host 3 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     Scanning host 4 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     Scanning host 5 channels 0 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs     0 new device(s) found.                    0 device(s) removed.                       Any ideas? Thanks in advance.


title: File sharing solutions for LAN network?

text: If I want to share my Films/Videos on LAN, what should I choose? My solution would be Samba.      Q: what else is there? ( NFS is very bad - security (?) + in many cases it could freeze the clients.. )      The main purpose is that it must be a "mountable" solution - so the clients can see a "folder" (the "folder" is actually the shared folder on a server - READ ONLY!). And they don't need to first copy the e.g.: AVI files to their PC because they could play them directly from the "folder".


title: Is it safe to assume that null or unset variables will be substituted with zero in bash arithmetic expressions?

text: I found the following statement in the bash manpage (version 4.2) under the Arithmetic Evaluation section. > A shell variable that is null or unset evaluates to 0 when referenced by > name without using the parameter expansion syntax. In the Advanced Bash Scripting Guide, there is a page with the following comment.               #  Bash (usually) sets the "integer value" of null to zero     #+ when performing an arithmetic operation.     #  But, don't try this at home, folks!     #  It's undocumented and probably non-portable behavior.      Here are examples of this behavior:               $ foo=     $ let 'foo += 5'     $ echo $foo     5     $ unset foo     $ let 'foo += 2'     $ echo $foo     2      Is it safe to assume that bash will substitute null variables with 0? Could assuming so result in code that is unportable between bash versions?


title: Why does my Linux mint freeze?

text: I am running Linux mint 32 bit. My problem is that the operating system freezes randomly. When this happens, the only solution I have is to shut down by pushing the power button of my laptop, because neither my laptop keys nor mouse nor touch pad works or responds. I have encountered this problem with both the 64 bit and the 32 bit versions. Some relevant information:               sai@SRKheaven ~ $ inxi -Fxz     System:    Host: SRKheaven Kernel: 3.2.0-23-generic i686 (32 bit, gcc: 4.6.3) Desktop: Gnome Distro: Linux Mint 13 Maya     Machine:   System: Acer (portable) product: Aspire V3-571 version: V1.07                Mobo: Acer model: VA50_HC_CR version: Type2 - Board Version Bios: Acer version: V1.07 date: 05/11/2012     CPU:       Dual core Intel Core i5-3210M CPU (-HT-MCP-) cache: 3072 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9977.76                 Clock Speeds: 1: 1200.00 MHz 2: 1200.00 MHz 3: 1200.00 MHz 4: 1200.00 MHz     Graphics:  Card: Intel Ivy Bridge Graphics Controller bus-ID: 00:02.0                 X.Org: 1.11.3 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz                 GLX Renderer: Mesa DRI Intel Ivybridge Mobile x86/MMX/SSE2 GLX Version: 2.1 Mesa 8.0.4 Direct Rendering: Yes     Audio:     Card: Intel Panther Point High Definition Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0                Sound: Advanced Linux Sound Architecture ver: 1.0.24     Network:   Card-1: Broadcom BCM43228 802.11a/b/g/n driver: wl bus-ID: 03:00.0                IF: eth1 state: up mac: <filter>                Card-2: Broadcom NetLink BCM57785 Gigabit Ethernet PCIe driver: tg3 ver: 3.121 bus-ID: 02:00.0                IF: eth0 state: down mac: <filter>     Drives:    HDD Total Size: 500.1GB (1.7% used) 1: /dev/sda TOSHIBA_MK5059GS 500.1GB      Partition: ID: / size: 97G used: 8.0G (9%) fs: ext4 ID: swap-1 size: 4.12GB used: 0.00GB (0%) fs: swap      Sensors:   Error: You do not have the sensors app installed.     Info:      Processes: 171 Uptime: 37 min Memory: 948.2/2622.6MB Runlevel: 2 Gcc sys: 4.6.3 Client: Shell inxi: 1.7.33       How can I resolve this freezing? What could be the exact problem for this type of behavior? Is it the only solution to shut down box manually? * * * **Update:**   1. Are you using the native drivers for the Nvidia graphics card or the ones included with your distro?      * No, I did not install any drivers explicitly.    2. Are you doing anything specific when the freezing occurs?      * Specifically, I have opened Google Chrome. At one instance it froze. None of the shortcut works, neither ctrl+alt+F1 or any other.     * Some other time, I have opened Firefox and it froze.     * Another time, when I was typing something in the gedit text editor.   3. What applications are running when the freezing occurs?      * Browser, like Chrome. Firefox, Gedit are opened. And these are opened at different times.


title: How to tell if terminal session is running within screen

text: When running a bash script, I would like to be able to tell if it is running within a `screen`. Is this possible? I want this so that `.bashrc` can set the colour of the command prompt depending on whether the sessions is started within a screen or not. Discovered this link once mine was answered: How can I tell whether I'm in a screen?


title: Store all dates in a given date range into a variable

text: I want to store all possible dates between two user input dates. The input will be as like **20140605** and **20140830**. I want to store every date between the given dates into a variable using a loop so that I can use it. The date generated or calculated must be in the same format as the input.               startdate=20141030     starttime=165800          enddate=20141120     endtime=175050          day=`expr $startdate % 100`     month=`expr $startdate % 10000`     year=`expr $startdate % 100000000`     month=`expr $month / 100`     year=`expr $year / 10000`     echo "$year  $month  $day"          while [ $enddate -ge $cdate ]     do     var=$cdate          #using variable var          if  [ $day -eq 31 ]; then     cdate=`expr $cdate - $day`     day=1     ((month++))     cdate=`expr $cdate + 100 + $day`     #cdate=`expr $cdate + $day`         if  [ $month -eq 13 ]; then             #tmp=`expr $month \* 100`             cdate=`expr $cdate - $month \* 100`             month=1             ((year++))             cdate=`expr $cdate + 10100`             if [ $year -eq 2999 ]; then                 ((year++))                 echo $cdate                 cdate=30010100             fi         fi     else         ((day++))         ((cdate++))      fi          if [ $enddate == $cdate ]; then     check=1     fi     done      I have tried to implement my requirement this way. But on compilation it says: > unary operator expected What is the cause of this error, and how can I do this in a better way using a shell script?


title: How to make /etc/init.d script act like it's launched under X?

text: I'm trying to track down some quirkiness with a Java application that misbehaves when launched via a startup script in /etc/init.d , but runs fine when you open a GUI terminal window and run it through /etc/init.d/myapp start. (The quirkiness involves a portion of the app that does some hacky handwaving with X.) Since the app runs fine when launched via a terminal window, I'm looking at how it's launched before I dive into (admittedly delicate and not my) source code. The answer at this post gave me a clue that the Gnome terminal is running inside a window manager, which is somehow affecting (in a good way) the environment of the application I launch through a bash script. I was able to verify that launching the script through a tty terminal (ctrl-alt-f1 or via ssh) gives the same behavior as launching on startup. **My main question:** What can I do to start this application when the computer starts, but have it act like it's been started under X? We've gone the script route up 'til now because it also needs to start a Java VM with certain parameters. **The follow up question** (strictly to enhance my understanding): What is going on under the hood to make a script act differently when it's launched via something running in a window manager? Google has not enlightened me on this.


title: vim syntax region: How to use strings as start / end patterns?

text: I want something like this in one of my syntax files:               let s:mask1="some chars here"     let s:mask2="and some chars here"          syntax region MyOwnRegionName start=s:mask1 end=s:mask2      (the idea is to use variable `s:mask1` in several region definitions.) But that wouldn't work. Vim reports following errors:               E402: Garbage after pattern: s:mask1 end=s:mask2     E475: Invalid argument: bmlRecsOps start=s:mask1 end=s:mask2      I managed to workaround this problem:               execute 'syntax region MyOwnRegionName start=/'.s:mask1.'/ end=/'.s:mask2.'/'      But I do not quite understand why and how it works. I am not sure it is a right way. Preparing a string which contains a command - there is something wrong about it. Or is it?


title: Error when running ntpd on openVZ host: cap_set_proc() failed to drop root privileges:

text: CentOS 6.x | OpenVZ I want to run a NTP server on a vps host of mine. Is this possible? When I try to start ntpd, it fails immediately and gives the following error:               Mar 14 22:47:44 ev1 ntpd[3456]: cap_set_proc() failed to drop root privileges: Operation not permitted      I've localized it to a setting in /etc/sysconfig/ntpd               # Drop root to id 'ntp:ntp' by default.     OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"      When this line is enabled, it fails (presumably because the shared kernel refuses to allow the privileges change). If I comment it out, ntpd runs fine but runs as root which is A Bad Thing. Is there anyway to get ntpd to run as the ntp user on openVZ? Admittedly I know it's a great idea to have this running on a OpenVZ server but I'd still like to try.


title: How to know if a file has been written completely?

text: I have shell script which waits for some files to arrive from remote machine, when it arrives, it cats them to a new file. For that I am using a while loop,like following:               while true     do              if [ $(find ../Test_Data/local_enc* | wc -l) -eq 2 ]         then                 break         else                 sleep 0.001              fi     done     cat ../Test_Data/local_enc* > ../Test_Data/All_Enc_Coords.txt      The problem is All_Enc_Coords file is written sometimes, and sometimes not written. I think this is because, find function returns some value, even when the file has no data in it. How to ensure that the files have been written successfully?? and how to specify it in the while loop. That means, I want all the files to be written completely and then cat them?.. I used sleep 1 before cat and found that the file is written completely, but is there any way round to check this??


title: How to select complete file in vi, to be pasted in gedit?

text: I know that doing `%y a` will yank complete file into register `a`. However this doesn't help in pasting the file content in another text editor (say gedit). What alternative is there for doing so?


title: How to load kernel module in Chromium OS?

text: I've installed the Chromium Vanilla by Hexxeh to a USB drive, but I can't use it on my computer because it lacks the carl9170 driver, which is needed by my adapter (a D-Link DWA-160.) I've managed to get it booted on the Netbook, whose wireless chip is supported, and I've downloaded carl9170-1.fw version 1.9.7 for Linux kernel 3.1 and higher (the version of Chromium OS I have uses 3.0.4.) Unfortunately, I haven't managed to get the driver loaded. I've tried putting it in all kinds of locations, and I've made lots of different attempts to load it with both `modprobe` and `insmod`, but I can't seem to figure out what to do. `modprobe` usually complains about "module not found".


title: Cannot Restore LAN Connection

text: I have two servers, 198.162.0.4 and 198.162.0.10, that were connected across a LAN. They are the components of a DMZ where 198.162.0.4 is the wen server and 198.162.0.10 the application server. 198.162.0.4 is running Ubuntu 11.04 while 198.162.0.10 is running Ubuntu 11.10. I had to restart 198.162.0.10 because Unity froze up. (I have since replaced it with Gnome.) Ever since I started it up again, I cannot get connectivity with 198.162.0.4. When I try               ping 192.162.0.4      I get               PING 192.162.0.4 (192.162.0.4) 56(84) bytes of data.      That is, it just hangs. I get the same result if I try               ping 192.162.0.10      on 192.162.0.4. I had been saving my iptables in iptables.save but now I see that that fie is of zero size for some reason although I had a lot of rules in the IPtable. I tried to fix the problem with               sudo iptables -A OUTPUT -s 192.162.0.4 -j ACCEPT     sudo iptables -A OUTPUT -d 192.162.0.4 -j ACCEPT     sudo iptables -A INPUT -s 192.162.0.4 -j ACCEPT     sudo iptables -A INPUT -d 192.162.0.4 -j ACCEPT      but it has no effect. How do I fix it?


title: Move command lost file

text: Did this once before but managed to find the file, however this time it seems to be gone or perhaps invisible? `mv foo.mpg /foo`


title: Why does copying from a script screw with my files?

text: I am at a loss here, trying to find out the reason why a shell script that is basically copying a couple of files and directories from one place to another will result in the content of two of the files (and only those two) being purged and replaced by `link ../../modules/[name_of_file]`.               APPFOLDER="/home/opt/ke"     CMD_APPCOPY="cp -fr _opt/ke/* $APPFOLDER"     [...]          echo "copying app-files to app-folder $APPFOLDER ..."     eval $CMD_APPCOPY     if [ $? -ne 0 ] ; then        echo "could not copy app-files to app-folder $APPFOLDER"        exit     fi      If I start the file copy by hand everything is fine.               cp -fr _opt/ke/* /home/opt/ke      But if I run the script the two files will be empty except for the `link ../../modules/[name_of_file]` part added on top of the empty file. The two files in question are neither very huge or very small in size, the only thing that differentiate them from the other files in that directory is that they are of the Perl-Module .pm type. Their actual source destination is `/home/xxx/xxx/deploy/KEB/_opt/ke/modules/` while the full target destination is `/home/opt/ke/modules/`. The script and the manual copy are run from `/home/xxx/xxx/deploy/KEB/` of course. Any idea/advice how this behaviour could be explained or what I should be looking for in order to fix the script is very much appreciated.


title: List all open '.log' files in *nix

text: There are times as a system administrator, you might not be sure of the log file paths of a new application. Depending on the system, there may be multiple ways to find the same. Please share the different ways we can get a list of open log files on a system.


title: WebGL in Firefox - Debian Squeeze

text: I'm trying to get working WebGL on Firefox without success, I tried forcing WebGL in the Firefox configuration and updating the Mesa drivers, but it's still not working. It's working on Opera, so the problem isn't the driver... I have an integrated Intel HD Graphics... about:support:               Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0     Adapter Description Tungsten Graphics, Inc -- Mesa DRI Intel(R) Ironlake Mobile x86/MMX/SSE2     Device ID   Mesa DRI Intel(R) Ironlake Mobile x86/MMX/SSE2     Driver Version  2.1 Mesa 7.10.3     GPU Accelerated Windows 0/1 Basic     Vendor ID   Tungsten Graphics, Inc     windowLayerManagerRemote    false     AzureCanvasBackend  cairo     AzureContentBackend none     AzureFallbackCanvasBackend  none      Graphic card info:               # lspci -v | grep VGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02) (prog-if 00 [VGA controller])      OpenGL version               # glxinfo | grep OpenGL     OpenGL vendor string: Tungsten Graphics, Inc     OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile  x86/MMX/SSE2     OpenGL version string: 2.1 Mesa 7.10.3     OpenGL shading language version string: 1.20     OpenGL extensions:      about:config (webgl properties):               webgl.can-lose-context-in-foreground;true     webgl.default-no-alpha;false     webgl.disable-extensions;false     webgl.disabled;false     webgl.enable-draft-extensions;false     webgl.force-enabled;true     webgl.force-layers-readback;false     webgl.lose-context-on-heap-minimize;false     webgl.max-warnings-per-context;32     webgl.min_capability_mode;false     webgl.msaa-force;false     webgl.prefer-16bpp;false     webgl.prefer-native-gl;false     webgl.shader_validator;true      I tried the WebGL test get.webgl.com, but it says that the browser support it but is not activated... Any suggestion??


title: Wi-Fi disconnects immediately?

text: I'm trying to connect to a WPA2 network. It works fine (I can connect to things) for about 10 seconds, then disconnects. When I try to connect again, it refuses to connect at all unless I've rebooted since last trying. I've tried NetworkManager and wicd, and both do the same thing. It works fine on my home (unencrypted) network, but it does this on the WPA2 one.               3.11.4-1-ARCH      Output of `dmesg`: http://pastebin.com/6QNu26dW


title: How could I eliminate Kerberos for passwd?

text: When I issue a command to change my password like this: `sudo passwd huahsin` The system prompt me: `Current Kerberos password:` I don't know what I have done to the system configuration, how could I eliminate this Kerberos thing when I change my password?


title: On Linux, can you write to HFS+ extended attributes?

text: I'm in the process of setting up a file server, and I'm looking for a way to preserve extended attributes in files that come from OS X machines, and manipulate them while the file is on the server. Obviously (well, presumably) this will require using HFS+ on the server, which is not a problem (unless there are hidden downsides I should know about), but I'm concerned that the support for HFS+ is minimal and will either (1) not preserve these attributes, or (2) preserve them but require copying the file to an OS X machine to manipulate them. How complete is the support for HFS+ in Linux? Will I be able to do everything I've mentioned?


title: bash readline: Key binding that executes an external command

text: (Background: I'm a long-time tcsh user, gradually transitioning to bash, and trying to find equivalents for some useful tcsh-specific features.) In tcsh, I can define a key binding that executes an external command. For example, given:               bindkey -c ^Gu uptime      I can type "Control-G u" in tcsh, and it will execute the `uptime` command. I don't have to type Enter, the command doesn't appear in my history, and I can do it in the middle of an input line (I find the latter particularly useful for certain commands). bash has a similar key binding mechanism via the GNU readline library, with bindings specified in `$HOME/.inputrc` (or elsewhere). But after reading the `info readline` documentation, I don't see a way for a key binding to execute an external command. The closest thing I've figured out is to add something like this to my `.inputrc` file:               "\C-gu": "uptime\n"      but that doesn't execute the command; rather, it acts as if I had typed `uptime` followed by the Enter key. The command appears in my history (that's ok), and it works only on an empty line; if I type `"echo control-Gu"`, then it prints `uptime` rather than executing the command. Another minor drawback is that the binding affects other commands that use GNU readline, such as the Perl debugger. Is there a way to simulate the effect of tcsh's `bindkey -c` in bash, by mapping a key sequence to the execution of a specified external command? If it matters, I'm using bash 4.2.24 on Ubuntu 12.04 beta 2.


title: Drop a specific file from the Linux filesystem cache?

text: I know I can drop everything from the Linux filesystem cache, but is there a way to drop just one specific file? Or prevent a file from being cached? Or tell a process not to cache any files it writes? I have a process that reads a lot of little files and writes a big file. I want to keep the little files in cache to avoid disk seeks, and I don't care about caching the big file.


title: Value of /proc/sys/kernel/hostname

text: I've set computer hostname in `/etc/hostname` a while ago (also there are record in `/etc/hosts`). Everything worked fine, but recently I've noticed that value of `hostname` (and `/proc/sys/kernel/hostname`) changed (to hostname of neighbour computer), although I haven't touched anything related. Value of `/etc/hostname` remains correct. Which mechanism may cause such change? There are similar problem description, but it doesn't contains any solution.


title: Is there a way to show all flags in /proc/mounts?

text: Some filesystem flags seem to be hidden in /proc/mounts, depending on whether they are defined as defaults. Is there a way to show all flags in /proc/mounts, also including the default ones? And if not, is there another command to see all enabled flags for the mounted filesystems? My background: I have set the data=writeback flag in fstab and also passed it to the kernel in my grub configuration, but it is still not listed in /proc/mounts. Now, how can I find out whether this is because data=writeback is a default (and thus not shown), or because the flag is indeed not set?


title: Where can I find cpu temperature and frequency without any specific command?

text: I want to make a shell script that runs as a daemon process and every X minutes read the temperature of every cpu core to report it later with `GNU plot`. And here is my question, Is there any file in `/sys` or `/proc` or any other location which this info be uniformly placed across several UNIX systems (not only in Linux)? If not, tell me at least, where can I find these files in Linux.


title: rsync ignore owner, group, time, and perms

text: I want to know how use rsync for sync to folders recursive but I only need to update the new files or the updated files (only the content not the owner, group or timestamp) and I want to delete the files that not exist in the source.


title: replace lines in a text with matching text

text: Original file               123|abc|heloo good morning friends|1|123|abc|123|abc     123|abc|heloo good morning everyone|1|123|abc|123|abc      Replaced file               123|abc|heloo good morning freinds|1|123|abc|123|abc     123|abc|this is what i want to see|1|123|abc|123|abc      Here as you can see the separator is `|`. Now if any block contains the word "everyone" that particular block should be changed to "this is what i want to see".


title: Installation script for OpenERP, creating directories under /var

text: I would like to know what this code means. I found it on the OpenERP forum. It is supposed to run on Linux CentOS.               adduser openerp     DIR="/var/run/openerp /var/log/openerp"     for NAME in $DIR     do     if [ ! -d $NAME ]; then        mkdir $NAME        chown openerp.openerp $NAME     fi     done     rm -rf openerp*      I got to know that we are creating user called openerp and after that i am not getting what they are telling.


title: Off by 1 year error in GNU date?

text: Right now, 2014-01-06, GNU date 8.4 on CentOS release 6.4, does this:               $ date --date "last week" +"%Y-%V"     2013-01      On the other hand,               $ date --date "last week" +"%Y-%U"     2013-52      which is just marginally better. Is this really the correct behavior?!


title: What is advisory locking on files that Unix systems typically employs?

text: I read that Unix like system typically use advisory locking for file IO vs mandatory locking used by Microsoft OS's. If I understood correctly in mandatory locking file lock is enforced by the OS itself. But I do not get the intuition of advisory locking. Take the example of two process,say "A" and "B" that are working on file "foo". Lets say "A" writes to "foo" and "B" reads from "foo". How would advisory locking work in this scenario? If the OS/file system is not enforcing a lock for "foo" then how is consistency maintained for reads and writes?


title: How could all the GNOME keyboard shortcuts be removed in a script, in other words, NOT using gconf-editor?

text: I am developing custom software on a RHEL system, which tightly locks down every user on the system. I have implemented my own lock screen through `dbus`, user screen lock (`Alt`+`L`) through `xbindkeys`, and that's pretty much all I want them to be able to do. I have an installation script for root to perform but for now, unfortunately, for every user root creates he has to go to `gconf-editor` or through the `System->Keyboard Shortcuts->Disable, Disable, Disable,...` sequence. Is there a way to run a command to remove all keyboard mappings for a user? Maybe through `gconftool-2`?


title: grepping of common lines between two file based on specific columns values in case of multi matching

text: I want to match column3 of file1 & column2 of file2 , after that i want to print all column of matching lines in a single line, i know how to do it but the problem is that if there are not unique vales in column2 of file2 then output will be last matching line of file2. but i want that (conflicting) multi matching lines in seperate file & only matching unique line in output file.   example:-   I have two file like these: `file1`               abc ram_1 ram1       abc ram[0] ram0       bcd raghu_reg_9 raghu9       cde tanu/8 tanu8       `file2`               1 ram1       2 thakur56       3 ram0       4 ram1       5 ram2       6 raghu9       7 raghu        I tried awk as:               awk 'FNR==NR{a[$2]=$0;next} { if ($3 in a){print a[$3],$1,$2}}' file2 file1        This gives output as:               4 ram1 abc ram_1       3 ram0 abc ram[0]       6 raghu9 bcd raghu_reg_9       But i want output1 as:               3 ram0 abc ram[0]       6 raghu9 bcd raghu_reg_9        And in output2 as:               1 ram1 abc ram_1       4 ram1 abc ram_1        because there are two entries for ram1 in column2 of file2 & when we match ram1 of column3 of file1 to the ram1 of column2 of file2 then this will match twice & will give 2nd ram1 as output, but i want that if this type of condition arise then these conflicting lines should go to seperate file so that i can manually decide which one should i choose.


title: How do I search for all the folders that begin with a dot ( . )?

text: My server had been infected and the attacker spread a bunch of `.5randomletters` folders around my file system, with malicious code inside of them. I want to search for all the folders that begin with a dot, review them and then remove them. How can I do that?


title: How to download bcache-tools with git?

text: This site says: > You'll need make-bcache from the bcache-tools repository. Both the cache > device and backing device must be formatted before use.   >  make-bcache -B /dev/sdb make-bcache -C /dev/sdc > > Wiki and git repositories are at: http://bcache.evilpiepirate.org   >  http://evilpiepirate.org/git/linux-bcache.git   >  http://evilpiepirate.org/git/bcache-tools.git


title: Why do the members of a bridge lose their Ip address?

text: I have created a bridge using to existing network interfaces:               $ brctl addif br0 eth1     $ brctl addif br0 eth2      Why do `eth1` and `eth2` lose their IP addresses? What's the reasoning behind it? PS this is on Ubuntu Linux.


title: Is expect tool availabe for ARM platform

text: I need to get `expect` (tool for automating interactive applications) for the ARM platform. Is it a readily cross compiled to ARM and is it available? I tried googling but was unable to get the binaries.


title: Shellscript to print a directory tree and files's contents with a nice presentation

text: I'm trying to write a shellscript which prints a tree-view for a specific directory and it's subdirs to pdf via latex, as well as the titles and contents of all scripts contained within that primary directory. The treeview works like a charm, but I have no idea how to get the printing of the scripts to work. Code thus far:               #!/bin/bash          # Script to export directory with pdflatex          # Generate .tex file     # Directory Listing     echo "\documentclass[11pt,a4paper,oneside]{article}" > tmp.tex     echo "\usepackage{fullpage}" >> tmp.tex     echo "\begin{document}" >> tmp.tex     echo "\section{Listing}" >> tmp.tex     echo "\begin{verbatim}" >> tmp.tex     tree $1 >> tmp.tex     echo "\end{verbatim}" >> tmp.tex     echo "\end{document}" >> tmp.tex          # ShellScript printout     ???????          # Generate .pdf file     pdflatex tmp.tex          #Cleanup     rm tmp.tex


title: Step-by-step guide for installation of 2 different Linux OSs and Window OS - on the same computer

text: Is there any existing step by step guide instructing how to install 2 different Linux OSs (say, Red Hat and SUSE), and Windows OS on the same machine? (When tried it I entangled with the partitions configuration, and I've heard from others that the secondary Linux has to be installed without its boot loader).


title: mirror a site with wget that only response with gzip

text: I'm trying to mirror a site but the server only responses with gzip pages so wget won't recurse. I've searched around and there are some references to a patch to add gzip support to wget however they seem to be out of date. Is there anyway to do this? If not I was considering reverse proxying it through nginx.


title: Sunrise and other astronomical data from the command line

text: Is there a simple open-source, command-line program that can show the sunrise and sunset times at a given date and location, and perhaps moon and planet data as well? Browsing the Debian package database and Google searches, I can't find anything relevant. This surprises me — considering the number of people who are both astronomy geeks and unix geeks, I'd have expected a de-facto-standard `sunrise(1)` (or perhaps `sunrise(6)`). I am not interested in more complex programs that incidentally perform the calculations, such as sky maps (celestia, kstars, starplot, stellarium), earth maps (sunclock, xplanet), calendars/agendas (emacs, remind), clocks (glunarclock, wmsun), tide almanachs (xtide). There is perhaps `aa` (astronomical-almanac), but I don't see a simple way of asking it what time the sun will rise on this date at these longitude and latitude. What did I miss?


title: SSH getting disrupted intermittently

text: I have Red Hat Linux Enterprise Edition 5 on my box. Recently I started having issues with my SSH service not keeping my connection and randomly disconnecting my clients. Ping works perfectly fine, except that port 22 is blocked randomly. Has anyone faced this issue? What is the solution?


title: getent passwd when nsswitch passwd setting is: files ldap

text: If nsswitch has `passwd: files ldap` set, and I do `getent passwd` will it first run down the /etc/passwd list and then go through every user in LDAP? That seems to be what happens. I tried it on a Red Hat server and it was scrolling thousands of lines when /etc/passwd is only 36 lines.


title: Which Bootloader is Used on a Chromebook?

text: I installed ChrUbuntu on an Acer C7 Chromebook, and I am able to dual boot Ubuntu 12.04 and ChromeOS and to control which OS loads by default. I tried to edit the `/etc/default/grub` file and did run `update-grub` successfully but saw no effects. I was trying to enable a "dmesg" style verbose system loading screen instead of the quiet splash screen (during the Ubuntu boot). I suspect that GRUB is not the bootloader on the machine or is functioning as a fairly late secondary bootloader only on the Linux partition. I realize that the Chromebook is a fairly closed system tightly controlled by Google, but since it is Linux at heart people may know the answer. I don't need the "dmesg" style verbose boot badly enough; but did became curious about the bootloading on this system. P.S. Just to clarify, I was trying to enable the verbose loading screen on the Ubuntu boot on the machine.


title: Understanding two flags and a dollar sign in a CURL command

text: I right clicked a post request in Chrome and selected Copy as cURL I got a cURL command that includes the following                --data-binary $'------WebKitFormBound      I am used to seeing cURL requests that have a single flag and string. Like this               $curl -0 "output.txt"      I understand that the `\--data-binary` command will post binary data (presumably after converting the string after the --databinary switch into binary). But what does the dollar sign mean? What does the curl request mean if it has two dashes and a dollar sign?


title: mount luks volume through pam with gdm

text: I'm on debian testing. I encrypted my /home with dm-crypt (luks). Following various tutorials I setup pam_mount to open it at login time. However when I try to login using gdm, it fails. The login screen disappears and reappears shortly after. In /var/log/auth.log I have:               Jul 11 00:18:20 yojik gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user Debian-gdm by vic(uid=0)     Jul 11 00:18:20 yojik gdm-launch-environment]: (pam_mount.c:173): conv->conv(...): Conversation error     Jul 11 00:18:20 yojik gdm-launch-environment]: (pam_mount.c:477): warning: could not obtain password interactively either     Jul 11 00:18:20 yojik gdm-launch-environment]: (mount.c:72): Messages from underlying mount program:     Jul 11 00:18:20 yojik gdm-launch-environment]: (mount.c:76): NOTE: mount.crypt does not support utab (systems with no mtab or read-only mtab) yet. This means that you will temporarily need to call umount.crypt(8) rather than umount(8) to get crypto volumes unmounted.     Jul 11 00:18:21 yojik gdm-launch-environment]: (mount.c:76): crypt_activate_by_passphrase: Operation not permitted     Jul 11 00:18:21 yojik gdm-launch-environment]: (pam_mount.c:522): mount of /dev/disk/by-uuid/d79121a7-5fbd-4484-81d2-6cbdf1b95b5e failed      If I switch to a virtual terminal (ctrl-alt-f1) and login there, the /home volume is mounted as expected. I can then go back to gdm and login normally. So the problem is really in the interaction of gdm and pam_mount. I tried to tweak /etc/pam.d/gdm3 following various tutorials and threads... But no success. Most info is pretty old and the only one really updated (Arch linux wiki) seems to have a different implementation of gdm as the files and options have quite different names. Currently my file looks like this:               vic@yojik:~$ cat /etc/pam.d/gdm3     #%PAM-1.0     auth    requisite       pam_nologin.so     auth    required    pam_succeed_if.so user != root quiet_success     @include common-auth     auth    optional        pam_gnome_keyring.so     auth    optional        pam_mount.so          @include common-account          # SELinux needs to be the first session rule. This ensures that any      # lingering context has been cleared. Without this it is possible      # that a module could execute code in the wrong domain.     session [success=ok ignore=ignore module_unknown=ignore default=bad]       pam_selinux.so close     session optional    pam_mount.so     session required        pam_loginuid.so     # SELinux needs to intervene at login time to ensure that the process     # starts in the proper default security context. Only sessions which are     # intended to run in the user's context should be run after this.     session [success=ok ignore=ignore module_unknown=ignore default=bad]       pam_selinux.so open     session required        pam_limits.so     session required        pam_env.so readenv=1     session required        pam_env.so readenv=1 envfile=/etc/default/locale     @include common-session     session optional        pam_gnome_keyring.so auto_start          @include common-password      Question is: how should I modify the file to get the volume mounted with gdm? EDIT: Here is also `/etc/pam.d/common-auth` (minus the info at the top saying to run `pam-auth-update` to manage the file, which I also did)               # here are the per-package modules (the "Primary" block)     auth    [success=1 default=ignore]  pam_unix.so nullok_secure     # here's the fallback if no module succeeds     auth    requisite           pam_deny.so     # prime the stack with a positive return value if there isn't one already;     # this avoids us returning an error just because nothing sets a success code     # since the modules above will each just jump around     auth    required            pam_permit.so     # and here are more per-package modules (the "Additional" block)     auth    optional    pam_mount.so      auth    optional            pam_cap.so      # end of pam-auth-update config


title: understanding od -a option

text: In Linux, the `\--type a` option in `od` is explained as > `\--type=`   >        Select the format in which to output the file data   >  …   >  `a`   >       named character, ignoring **high-order bit**   >  …   >  Only the least significant seven bits of each byte is used; the high-order > bit is ignored. Now this answer here explains a lot, especially " _and words were two bytes long_ " - which leads to my specific **Question** : _What does **high-order bit** mean in connection with "named characters"_ Maybe I'm just missing something…


title: Get the information of each (single) flowing packet

text: `tcpdump` buffers data up to the default buffer size and then dumps it into disk. But let's say I need to get the information of the current flowing packet (a single packet), i.e. I don't want to wait for the buffer to be full. I'm currently testing with ICMP packets. First I thought I could change the buffer size to make it dump "faster" but this is not very accurate... Is there a way to dump each single packet as they arrive into a file? or any other way that makes it possible to check its information?


title: Verify that partition is encrypted

text: I just installed Debian and as far as I can remember I encrypted my home- partition using LVM. During the boot process I haven't been asked to enter the password. Is there any way to check whether the encryption is up and running?


title: How to cancel my job

text: I'm a beginner about LINUX in korea and English is too. I'm circulating some simulation by using the LINUX cluster but I have some problem in my job. I want to cancel any job (ID : 750, 752, 753 name : gib) but I don't know how to cancel this job. ![enter image description here](http://i.stack.imgur.com/4KZ0y.jpg)


title: Cant ssh, connection terminates immediately with exit status 254

text: The most recent thing I remember is changing the soft and hard memlock ulimit to unlimited. Now I cant ssh into the machine. This is the ssh log.               Authenticated to IP ([IP]:22).     debug1: channel 0: new [client-session]     debug2: channel 0: send open     debug1: Requesting no-more-sessions@openssh.com     debug1: Entering interactive session.     debug2: callback start     debug2: fd 3 setting TCP_NODELAY     debug2: client_session2_setup: id 0     debug2: channel 0: request pty-req confirm 1     debug1: Sending environment.     debug1: Sending env LC_CTYPE =      debug2: channel 0: request env confirm 0     debug2: channel 0: request shell confirm 1     debug2: callback done     debug2: channel 0: open confirm rwindow 0 rmax 32768     debug2: channel_input_status_confirm: type 99 id 0     debug2: PTY allocation request accepted on channel 0     debug2: channel 0: rcvd adjust 2097152     debug2: channel_input_status_confirm: type 99 id 0     debug2: shell request accepted on channel 0     Last login: Wed Aug  6 07:18:07 2014 from IP-SOURCE     debug2: channel 0: rcvd eof     debug2: channel 0: output open -> drain     debug2: channel 0: obuf empty     debug2: channel 0: close_write     debug2: channel 0: output drain -> closed     debug1: client_input_channel_req: channel 0 rtype exit-status reply 0     debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0     debug2: channel 0: rcvd eow     debug2: channel 0: close_read     debug2: channel 0: input open -> closed     debug2: channel 0: rcvd close     debug2: channel 0: almost dead     debug2: channel 0: gc: notify user     debug2: channel 0: gc: user detached     debug2: channel 0: send close     debug2: channel 0: is dead     debug2: channel 0: garbage collecting     debug1: channel 0: free: client-session, nchannels 1     Connection to IP closed.     Transferred: sent 4256, received 2504 bytes, in 0.4 seconds     Bytes per second: sent 9616.9, received 5658.0     debug1: Exit status 254      I have tried the following unsuccessfully till now, before posting here:   1. Trying for a norc noprofile login by `ssh user@host 'bash --noprofile'`   2. Forcing a tty by `ssh -t user@host`   3. Moved the bash_profile. Tried sshing by `ssh user@host`.   4. Renaming the `limits.conf` file in hopes that it wont be read.   5. Restarted ssh server.   6. Run a command via `knife` as `knife ssh "name:server" "come_command"`   7. `ssh user@host 'ulimit -l 64'`, `ssh user@host 'ulimit -S -l 64'`, `ssh user@host 'ulimit -H -l 64'`, `ssh user@host 'exec ulimit -H -l 64'` I am not sure if this way of running commands inline: `ssh user@host "som_command"` works, because I cant get a simple directory listing. I also tried rebooting by `ssh user@host 'reboot'` but dont think the command was executed. I restarted the machine from AWS also, but unsuccessful. Is it a lost cause trying to ssh? Is there any way I can ssh into the server? Thank you.


title: How do I extract the content of quoted strings from the output of a command?

text: I have output from `VBoxManage list vms` which looks like this:               "arch" {de1a1db2-86c5-43e7-a8de-a0031835f7a7}        "arch2" {92d8513c-f13e-41b5-97e2-2a6b17d47b67}        I need to grab the names `arch` and `arch2` and save them into a variable.