Check whether network cable is plugged in without bringing interface up

I am trying to identify NICs on ~20 remote servers (2-6 NICs on every server). To begin with, I want to identify those ready for use and free ones. How can I check the state of the physical media? I know some ways, including `ifconfig|grep RUNNING`, `ethtool`, `cat /sys/class/net/eth0/carrier`, but all they require that the interface is up. I don't want to bring ALL interfaces up. Not sure why, but I don't like to have enabled, but not configured interfaces in the network. Is there a way I can avoid this? Or am I just wrong and there's nothing bad about all interfaces being up (and not configured)? Even if they are plugged in?


How to setup QoS on router (prioritize VOIP and web browsing over downloading)?

I've got Asus WL500GP-v2 router with renewed Oleg's firmware installed (http://code.google.com/p/wl500g/ , the stable version). I would like to setup some Quality of Service to ensure all users are able to browse web or use VOIP when one of them is mass downloading (torrent or http) or streaming online video or playing some online game. I also would like to prioritize local traffic from a NAS server that is in the same LAN and has a static IP address over VOIP communication (there is a backup service on NAS installed). I found that the router has WonderShaper installed (wshaper). How can I use this to achieve the policy? Or should I use something else? I have found a Prometheus QoS (http://gpl.arachne.cz/) that looks quite promising, but don't know how to use it (download vie wget, apt-get install package, and then what?).


evaluate multiple patterns from program output and write into pattern specific files

I have a script outputting some value/numbers and I want to split those into two files. I am looking at something like:               ./runme.sh | grep 'ook' >> ook.out | grep 'eek' >> eek.out      Where the second pipe should not, as is the case, take the output of the first grep but that of runme.sh. Is that possible?


How to create and edit a text file from the bash shell

I am logged into a linux server via ssh. From the bash shell, is there any standard way of bringing up some kind of text editing environment so I can create and edit a text file? I am aware that there exist apps like emacs and vi, but I don't know if they are appropriate for basic text file editing or if I should use something simpler, or if not, which one to use.


How parse a log file for a string, and when found search backwards for another string

I use the following command to parse a log file for a particular string. Then I search backwards in the log to find the data I really want. The problem as in the example below, I am only going back 50 lines. It is unknown if the text I am looking for will be 5 lines back, 200 lines back or more. Is there a way to search through a log file for a particular string, and when that string is found, to then search backwards through the log to find a 2nd string despite not knowing how far back the 2nd string is located. Also there could be multiple occurrence of the 1st string. So for for every instance of the 1st string, I want to be able to search backwards to collect the data from the second string.               grep -B50 "Server returned HTTP response code: 500 for URL:" LCSoap_8.log | \     tac | grep -P -o '(?<=qualified-src-dn=).*(?=src-dn)'


how to download a file using just bash and nothing else (no curl, wget, perl, etc.)

I have a minimal headless *nix which **does not have** any command line utilities for downloading files (e.g. no curl, wget, etc). I only have bash. How can I download a file? Ideally, I would like a solution that would work across a wide range of *nix.


Fedora 17 not booting

I just got GRUB to properly set the resolution, thanks to this wonderful answer. After selecting Fedora 17 and waiting a bit, this displays:               [   0.752888] [Firmware Bug]: powernow-k8: No compatible ACPI _PSS objects found.     [   0.752888] [Firmware Bug]: powernow-k8: Try again with latest BIOS.       (These two have dissappeared since enabling the Cool'n'Quiet BIOS setting)               Could not find platform independent libraries <prefix>     Could not find platform dependent libraries <exec_prefix>     Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]     ImportError: No module named site     [     0.758649] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000100     [     0.758649]     [     0.758980] Pid: 1, comm: init Not tainted 4.5.4-1.fc17.i686 #1     [     0.758306]  [<c093bb4b>] panic+0x81/0x17b     [     0.758455]  [<c043edfc>] do_exit+0x7fc/0x800     [     0.758612]  [<c043f094>] do_group_exit+0x34/0xa0     [     0.758649]  [<c043f118>] sys_exit_group+0x18/0x20     [     0.758649]  [<c094b2df>] sysenter_do_call+0x12/0x28      Knoppix and Fedora live boots work fine, though. Anything I short reinstalling Fedora I can to do to fix this? What other specs or information would be needed?


Why does vpnc not block the LAN interface?

VPNC allows local LAN access in spite of activating the vpnc on my RedHat Linux machine When we want to activate the Cisco VPN on win machine, once VPN is active then the LAN port isn’t accessible for `ping` or `ssh`. On our RedHat Linux machines (both real machine and on VMware), I installed VPNC version 6.3, and activated the vpnc, after configuring the `.pcf` file. VPN was activated, and I can ping to customer gateway. Until now everything is OK. But I notice that I still have access to my LAN on my Linux machine, meaning I can ping from my Linux machine to other external machines in the network. How can that be? Why doesn't vpnc block the LAN as it should? VPNC WIKI link - https://wiki.gentoo.org/wiki/Vpnc


find all symbolic links in a directory tree pointing outside that tree

I frequently move directory trees to other locations or copy their tarballs to other machines, and I would like to have a method to check whether any symlinks in a directory tree _A_ point to locations outside of _A_ since these will be broken in the moved / copied directory.


How to restore default group/user ownership of all files under /var?

I accidentally changed `/var` owner/group to my username and then changed it back to root, but not all the `/var` folders' owners are root, so is there anyway to change back owner/group of files/folders to default state? Or at least those files/folders that are created by packages?


Ubuntu How to re-install bootloader

I accidently altered my partition table. Somehow I wiped it out completely and changed the disk label. The system has not been rebooted yet and I managed to rebuild it the way it originally was using the original structure and label however I need to re-install a new bootloader for the new MBR. I have Ubuntu 14.04TLS running inside VirtualBox on a Windows 7 machine. Is there a way to do this without rebooting?


How do you get a count of all file extensions on a hard drive using the gnu+linux terminal?

On windows I have a program that can count all the files on a hard drive and the output shows a list of file extensions and a number (which showed how many files on the drive were for example are jpg). How do I do this in a terminal on gnu+linux?


Why is the exec option not listed in /proc/mounts?

My understanding is `/proc/mounts` should list all mount options for a filesystem, including kernel defaults, so I was surprised to see that exec (among others) is not listed here? For example, my root and home filesystems in fstab:               /dev/mapper/vg0-xen_root  /      ext4  noatime,errors=remount-ro  0  1     /dev/mapper/vg1-xen_home  /home  ext4  defaults                   0  2      and how they appear in /proc/mounts:               /dev/mapper/vg0-xen_root /     ext4 rw,noatime,errors=remount-ro,user_xattr,barrier=1,data=ordered 0 0     /dev/mapper/vg1-xen_home /home ext4 rw,relatime,user_xattr,barrier=1,data=ordered                  0 0         The filesystem independent defaults documented in `man mount`:               defaults         Use default options: rw, suid, dev, exec, auto, nouser, and async.         Why are some defaults (e.g. `rw`) listed but others (e.g. `exec`) are not? Is there a way to get the complete set of mount options associated with a filesystem?


MC (Midnight Commander) Full Path in Title Row of Internal Editor

On some systems (Midnight Commander 4.8.1.4, Midnight Commander 4.8.3) the MC shows the full path of the opened file in the internal editor and on other systems (Midnight Commander 4.7.0.2, Midnight Commander 4.6.2-pre1) not. For example if you open /home/user/examplefilename.log, you will see "File: examplef~ame.log" instead of "/home/user/examplefilename.log" in the title row. Is this just version dependend or is it a preference? I can't find any option or documention how to change it to show the full path.


SD Card interpreted as wrong size

I used `dd` to write a 2GB image to an 8GB SD card; `gparted` now sees it as a 2GB SD card and I can't figure out how to format it for 8GB again. `dd`also sees it as a 2GB SD card when trying to format it with `of=/dev/sdb if=/dev/zero bs=1M`. How can I get it to know its real size?


How to start a cron task?

It sounds really simple, but many times I was stuck at the beginning of learning a new command. The tutorial writer think it's natural to start, but it's not. This is the tutorial I've been reading: http://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800 After reading that, I started something like:               * * * * * /usr/bin/sh t.sh      And I got this error:               bxg: command not found      bxg is an empty file I created on the directory to debug, the tree graph is like this:               .     ├── bxg     └── t.sh       Inside t.sh, the content is:               a=$(date)     mkdir "$a"      Obviously, bash didn't recognize this as a cron command. Then I searched the cron process to see if it is started alread:               ps aux | grep cron          root       942  0.0  0.0   3056   908 ?        Ss   10:34   0:00 cron     zen       4924  0.0  0.0   4652   568 pts/1    T    11:54   0:00 grep --color=auto cron     zen       9722  0.0  0.0   4656   568 pts/1    S+   12:05   0:00 grep --color=auto cron      Seems it's running there, but as another tutorial says that the process is called crond. I tried the followed:                service crond start      crond: unrecognized service      Maybe the process I greped out with "ps aux" isn't the authentic process:               service cron start     start: Job is already running: cron      OK, I totally got no ideas now, friends help me!


Enable remote printing options with cups-lpd

I am trying to print from SCO OpenServer remotely to a CUPS-LPD daemon running on a Red Hat Linux machine but it is dropping any print options from the print request. For example:               lp -d remote-print-queue -o landscape print-file      The options presented to the filter / backend only contains a job-uuid:               argv[5]="job-uuid=urn:uuid:96ba0666-ca3d-337b-69bf-81f70e9fa2a7"      Is it possible to enable the pass-through of options using lpd remote printing?


Cross Unix Command Reference

I am looking for a website that contains a reference between how to do things on the command line in different unix OSs. I have seen such site before, I am just unable to find it. I know such site would be beneficial for the community.


Unexplained Log Cruft and Possible Dropped Packets on WPA2-Personal LAN

I've been receiving a LOT of log cruft ever since I installed my Linksys Rangeplus USB WUSB100v2 (using the rt2870sta community driver from the Linux kernel) and was wondering what it all meant. Many times when these messages occur it is accompanied by slow network speeds and many DNS queries and outgoing SYNs being dropped. I have searched for documentation for these (error?) messages and have come up empty as far as what they mean or how I can stop them from occurring. I reside on the opposite side of the building from my WAP. I have taken steps to improve the signal strength, but the signal quality hovers between 50% and 70%, sometimes dropping to 40% for unknown reasons. I am using Slackware64-current (kernel 2.6.33.4) with dhcpcd-5.2.7, wpa_supplicant-0.6.10, wireless-tools-29. My `/var/log/messages`:               Sep 12 05:04:40 necronomicon -- MARK --     Sep 12 05:29:48 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4284     Sep 12 05:29:53 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4104     Sep 12 05:30:06 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4156     Sep 12 05:31:02 necronomicon kernel: 0:3 LTL=0 , TL=0 L:12260     Sep 12 05:31:03 necronomicon kernel: 0:4 LTL=0 , TL=0 L:12260     Sep 12 05:31:21 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4100     Sep 12 05:31:28 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4160     Sep 12 05:32:41 necronomicon kernel: 0:3 LTL=0 , TL=0 L:5612     Sep 12 05:33:12 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4208     Sep 12 05:33:16 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4696     Sep 12 05:37:40 necronomicon kernel: 0:3 LTL=0 , TL=16896 L:24604     Sep 12 05:41:06 necronomicon kernel: 0:3 LTL=16896 , TL=0 L:4184     Sep 12 05:41:55 necronomicon kernel: 0:3 LTL=0 , TL=0 L:3456     Sep 12 05:42:20 necronomicon kernel: 0:3 LTL=0 , TL=0 L:24736     Sep 12 05:42:21 necronomicon kernel: 0:4 LTL=0 , TL=0 L:24736     Sep 12 05:42:22 necronomicon kernel: 0:5 LTL=0 , TL=0 L:24736     Sep 12 05:42:23 necronomicon kernel: 0:6 LTL=0 , TL=18944 L:24736     Sep 12 05:43:06 necronomicon kernel: 0:3 LTL=18944 , TL=0 L:2176     Sep 12 05:44:14 necronomicon kernel: 0:3 LTL=0 , TL=0 L:4996      My `dmesg`:               DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4996     0:3 LTL=0 , TL=0 L:4144     0:3 LTL=0 , TL=0 L:4100     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4832     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4184     0:3 LTL=0 , TL=0 L:5260     DeQueueRunning[0]= TRUE!     0:3 LTL=0 , TL=0 L:4200     0:3 LTL=0 , TL=0 L:4120     0:3 LTL=0 , TL=0 L:4140     0:3 LTL=0 , TL=0 L:5292     0:3 LTL=0 , TL=0 L:4188      My `/proc/net/wireless`:               Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE      face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22      wlan0: 0000   70.  -65   -83        0      0      0      0      0        0      My `iwconfig` settings:               wlan0     Ralink STA  ESSID:"Network Awesome"  Nickname:"necronomicon"               Mode:Managed  Frequency=2.457 GHz  Access Point: 00:16:B6:BA:FC:B0                  Bit Rate=12 Mb/s                  RTS thr:off   Fragment thr:off               Encryption key: [OMITTED]               Link Quality=67/100  Signal level:-63 dBm  Noise level:-83 dBm               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0      My `wpa_supplicant.conf`:               network={             ssid="Network Awesome"             psk="[OMITTED]"             proto=RSN             key_mgmt=WPA-PSK             pairwise=CCMP             priority=10             id_str="netawesome"     }


Create a GPT partition covering the free space

I have 480 GB SSD it currently has the following partitions 256MB EFI partition, 16GB SWAP, and 40GB CentOS 7 see details from `lshw` below. I want to use the remaining 400GB of unused space on the drive as an iSCSI target. The system only has /dev/sda1, /dev/sda2, /dev/sda3, there is no /dev/sda4 mapped to the 400GB of free disk space on the SSD. How do I add /dev/sda4 and map it to the unused 400DB on my disk so that it can be used as an iSCSI target? I am on CentOS 7.               *-scsi               physical id: 1               logical name: scsi3               capabilities: emulated             *-disk                  description: ATA Disk                  product: Crucial_CT480M50                  physical id: 0.0.0                  bus info: scsi@3:0.0.0                  logical name: /dev/sda                  version: MU03                  serial: 13440956E89D                  size: 447GiB (480GB)                  capabilities: gpt-1.00 partitioned partitioned:gpt                  configuration: ansiversion=5 guid=ab9704e2-9162-4c08-a759-956ad6a2f8f1 logicalsectorsize=512 sectorsize=4096                *-volume:0 UNCLAIMED                     description: Windows FAT volume                     vendor: mkfs.fat                     physical id: 1                     bus info: scsi@3:0.0.0,1                     version: FAT16                     serial: fa26-fbee                     size: 255MiB                     capacity: 255MiB                     capabilities: boot fat initialized                     configuration: FATs=2 filesystem=fat name=EFI System Partition                *-volume:1                     description: Linux swap volume                     vendor: Linux                     physical id: 2                     bus info: scsi@3:0.0.0,2                     logical name: /dev/sda2                     version: 1                     serial: c2b0907a-8337-4f32-b1e9-9affe6927264                     size: 15GiB                     capacity: 15GiB                     capabilities: nofs swap initialized                     configuration: filesystem=swap pagesize=4095                *-volume:2                     description: data partition                     vendor: Windows                     physical id: 3                     bus info: scsi@3:0.0.0,3                     logical name: /dev/sda3                     logical name: /                     serial: f7efca38-7631-4a20-ae0a-04942971d5ba                     capacity: 39GiB                     configuration: mount.fstype=xfs mount.options=rw,seclabel,relatime,attr2,inode64,noquota state=mounted      fdisk -l output below.               fdisk -l /dev/sda     WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.          Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk label type: gpt               #         Start          End    Size  Type            Name      1         2048       526335    256M  EFI System      EFI System Partition      2       526336     33294335   15.6G  Linux swap            3     33294336    115214335   39.1G  Microsoft basic


What is the `ucond` process state?

When debugging a program I saw that `top -U username` showed the following:               39769 eigenein       107  98    0   179M 38448K ucond  19   0:00  0.00% program      What does it mean that a process in the `ucond` state?


Installing a software on Linux- Centos

I am a complete amateur in Linux. There is a software that only runs on Linux. It came with a virtual machine package and every thing. When inside the virtual machine, I run a .py file in the terminal and it starts downloading the software. The software file is quite large. I noticed every time I let the software to download, the installation wants to start and asks me for the password. I am usually not there to enter and it fails. I wanted to see how I can get over this problem. Thanks


How to change locale environment variable?

I have generated _en_US.utf8_ , _et_EE.iso88591_ and _ru_RU.utf8_ localisation files. Now if I try to change any of the locale variables to a _ru_RU.utf8_ or _en_US.utf8_ , then this does not have any effect:               # locale -a     C     en_US.utf8     et_EE     et_EE.iso88591     POSIX     ru_RU.utf8     # LC_TIME=ru_RU.utf8     # locale | grep LC_TIME     LC_TIME="et_EE.iso88591"     # LC_TIME="ru_RU.utf8"     # locale | grep LC_TIME     LC_TIME="et_EE.iso88591"     #       However, if I change the _LANG=_ variable, then all other variables but _LANGUAGE=_ and _LC_ALL=_ take the value of the _LANG=_ variable. Is there a way to modify each locale variable separately? In addition, am I correct that locale variables aren't regular shell variables, but more like parameters to _locale_ utility?


Samba set share browsable only for a group

How I can configure samba to set browsable a share for a group only. I wanna hide the share for all other users, if a set browsable to `yes` all the users can see the share when explore. I don't want this behavior. Example a simple share               [myshare]         force group = mygroup         write list = mygroup         read list = mygroup         browsable = yes


Mplayer video output drivers

Is there a document somewhere describing each of mplayer's video output drivers and why'd you'd want to pick that one for a given circumstance (or why it exists) Would someone be willing to write that out here?


How to disable styling on man pages?

Is there an easy way to turn off all styling on man pages? Colors, bold, italics, everything... If not, what is an uneasy way?


relaying ports to remote pc via vpn

I've got a situation where a remote pcs is vpn'ed to my Ubuntu box, and I'm wondering how I set the Ubuntu box up to redirect calls to specific ports over to the PC. Any Ideas?


How to build svnwcrev

I'm having a bad time building svnwcrew, and as the readme file says: "There is no sophisticated installation procedure for this small utility."... I modified the config.mk file setting the APR_INCLUDE as the readme says, and when I run **make** : > http://pastebin.com/NE1nevek any suggestion to build this tool? Thanks!


Wireless doesn't connect automatically in Ubuntu when connection is established with wifi Router Again

I am facing a problem here with Ubuntu version 10.4 I am working with. I am having a wifi router and when I start my system, Ubuntu connects to wifi automatically. But if due to some reasons the connection is lost and established again then Ubuntu wireless system doesn't connect automatically and it pops up with a window to enter the key again to connect. There are many times I keep my system ON with something to download and went away for some time, only to come back and see that the Ubuntu is waiting for my inputs to connect again as router had lost its connection. Is there any file settings needs to be done so that it connects to wifi without and user input required ? Or is there any shell script or command which can help in doing that.


Emacs mode for man pages

I'm translating man pages, and have run in to a few problems with Emacs.   1. How do you specify language? (With man, it looks like this `man -Lsv shutdown` for the Swedish "sv" subdirectory, if available.)   2. In the Emacs man mode, you can use **N** or **P** to jump forward or backward according to headers (in roff, they look like this: `.SH`). But, this doesn't work if the header includes one (or more) of the three special Swedish characters: Å, Ä, and Ö. It doesn't matter if I escape them (like this `\(:A`). (But they are correctly displayed.)   3. To view a work in project, I use for example `M-x man RET ./ls.1` (that is, the absolute path). This is great, because it is the same man mode as for viewing "real" manpages (those in /usr/share/man). Only, when I do some changes in the document, how do I refresh the manpage? `revert-buffer` says the buffer is not associated with a file (not true, but OK, I get it); `M-x load-file RET` seems to have lost track of the file; ... Ideas? By the way, translating is a lot of fun! **EDIT:** (see the first comment) ![Table](http://user.it.uu.se/~embe8573/emacs_woman_man.png)


I usually use kubuntu, but I had to install a custom kernel on my laptop and it's a lot easier with arch. The problem is that kde looks terrible in arch, especially the GTK applications. I know there are all sorts of tutorials of installing gnome icons, and various peicewise fixes, but is there a way to find out exactly how kubuntu sets up KDE so I can just duplicate that?


How do you output a list of all man pages in a particular section?

A man page for `fork`, for example, is in the System Calls section that has number 2: `man 2 fork` How do you see what else is section 2 without resorting to Google?


Parse syslog messages into separate MySQL tables with rsyslog

Out of the box rsyslog will dump everything into the `SystemEvents` table within the `Syslog database (if you use the default schema provided). I would like to use a regular expression to filter inbound messages into separate database tables. I've played with this, but I'm having a hard time figuring out the best way to accomplish this (or even a way that functions). In my rsyslog.conf:               $template wireless, \      "insert into RogueAPs \      (ReceivedAt, DeviceReportedTime, Facility, Priority, FromHost, Message) \      VALUES('%timegenerated%', '%timereported%', '%syslogfacility%', '%syslogpriority%', '%fromhost-ip%', '%msg%');", \       stdsql          if $msg contains 'subtype=wireless' then :ommysql:127.0.0.1,Syslog,dbusername,dbpassword;wireless          *.* :ommysql:127.0.0.1,Syslog,dbusername,dbpassword      This was my latest attempt, but I'm stuck. (the RogueAPs table is just a clone of the default SystemEvents table that ships with rsyslog) * * * Version Info:               shell# /usr/local/sbin/rsyslogd -v     rsyslogd 5.5.5, compiled with:             FEATURE_REGEXP:                         Yes             FEATURE_LARGEFILE:                      No             FEATURE_NETZIP (message compression):   Yes             GSSAPI Kerberos 5 support:              No             FEATURE_DEBUG (debug build, slow code): No             Atomic operations supported:            Yes             Runtime Instrumentation (slow code):    No          See http://www.rsyslog.com for more information.


mutt sidebar: expand/collapse folders

Is there a way to expand/collapse a single folder or all folders in the `mutt- patched` sidebar? I couldn't find anything about this in the sidebar documentation.


How to get a program running with root privileges without using su or sudo

I have a `bash` script that needs to run with **root privileges** , but must be invoked by the normal user. Difficult part is that the script should not ask for a password, and I don't want to use the _sudoers_ file. I'd like to avoid using **sudo** or **su**. Is this possible?


Tweak gimp for performance

I just realized that I can start gimp (version 2.8) via `gimp -d` to reduce startup time on an old system. Are there other tweaks to speed up the startup time of gimp and reduce memory usage?


mutt: return to index after deleting or saving message in pager view

After deleting or saving a message in pager view in the MUA mutt, the program remains in pager view and jumps to the next message in the current folder. Can this default behavior be changed so that after deleting or filing an email, the pager mode is exited and the folder index is displayed?


Sun blade 2000 - no prompt

I just bought a Sun Blade 2000 and a type 7 USB keyboard from EBAY. The blade has Solaris 8 installed and while I can login, I'd rather switch to something like UBUNTU. If I type STOP - A during the boot process, I get a white screen but no prompt that I can see. The video card is PCI and seems to work fine with Solaris. I'm not sure if the prompt is being directed elsewhere? Any ideas?


TUI interfaces not displaying correctly

I have an Ubuntu 11.04 server on Amazon EC2 which cannot display TUI interfaces correctly, like on `Midnight Commander` or `tree`. ![corruption](http://i.stack.imgur.com/iTD3P.png) I'm quite sure that this problem was not there when I set it up, and I suspect that it may have occurred since I did a `apt-get dist-upgrade`. How can I fix this?


How can I launch applications from 2 ttys on launch?

I've currently got 2 ttys logging in automatically, but I need to launch a node script from one and a C program from another as soon as the device loads. The device is a Raspberry Pi running Raspbian. It's set up to function like an appliance, these two programs will run for a few hours at a time before the device is turned off. I've successfully launched my programs via `/etc/rc.local` but it seems that this isn't the same as actually launching from tty, they are closed before the prompt loads.


Service script calls another script with variables

I have a simple service script `tomcat7` in /etc/init.d/ to start and stop my app server (tomcat) under the tomcat user. On RHEL6.               #!/bin/bash     # description: Tomcat Start Stop     # processname: tomcat     # chkconfig: 234 20 80          CATALINA_HOME=/usr/local/www/tomcat-7.0.54          case $1 in     start)     /bin/su tomcat $CATALINA_HOME/bin/startup.sh     ;;     stop)     /bin/su tomcat $CATALINA_HOME/bin/shutdown.sh 30     ;;     esac     exit 0      Which works fine. Both `startup.sh` and `shutdown.sh` call a script called `catalina.sh`. These are pre-made scripts that come with the app server. I can use `catalina.sh` directly like: `./catalina.sh stop 30 -force` Which lets me specify a wait time of 30 seconds and then does a kill -9 if the process hasn't ended. But I can't get the variables to work in the `tomcat7` service script. If I change it to:               stop)     /bin/su tomcat $CATALINA_HOME/bin/catalina.sh stop 30 -force      I get an error:               [root@543917-web1 bin]# service tomcat7 stop     /bin/su: invalid option -- 'o'      Can I pass the three arguments without altering the catalina.sh script? TIA


When giving presentations, I use the html/css/js-based `showoff`. It has a presenter mode which shows the notes and the progress in a good way for me. It seems like the idea is that somehow a second browser gets the changes I do in this mode, but that does not work. Therefore I thought of putting just the part of the presenter mode which displays the current slide (this is a 1024x768 area) on another device, namely the beamer display. As `X` has such a vast tooling box, I figured this could be possible. The presentation has been given with mirrored displays, which went good enough. What remains is the curiosity if it would have been possible:               Can I display part of a window on the second device?      I use `xmonad` as window manager normally. If this is supported by another window manager, I could switch just for presentations. **UPDATE** I am more interested in the way this could be achieved by `X11` means (or related tools) than just having the presenation run fine. That's just the incident that created my interest in such a solution. **SECOND UPDATE** I am still looking for a pure X11-solution, but the problem at hand is of course solved.


iptables hangs at applying rules

I have a set of rules that are supposed to give me the most protection before things like fail2ban and other things are added to the mix. The issue is that although everything checks out in the test, when I `service iptables restart` it will shut down just right, but when it goes to apply the rule it hangs. Here is the set               # Allow all traffic.     #---------------------------------------------------------     *filter     :INPUT ACCEPT [81:5076]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [44:3868]          #---------------------------------------------------------     # protection based on http://thelowedown.wordpress.com/2008/07/03/iptables-how-to-use-the-limits-module/     # and https://gist.github.com/virtualstaticvoid/1024546     # and http://www.cyberciti.biz/tips/howto-limit-linux-syn-attacks.html     #---------------------------------------------------------          #---------------------------------------------------------     # General rules     #---------------------------------------------------------     # it is gerenally view as best practice to drop all and add     # just what is needed.  Drop and reject to prevent abuse      # of the system and sour the milk     #---------------------------------------------------------     -P INPUT DROP     -P FORWARD DROP     -P OUTPUT DROP               # Allow incoming HTTP     #---------------------------------------------------------     -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT     -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT          # Allow incoming HTTPS     #---------------------------------------------------------     -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT     -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT                    # Allow loopback access     #---------------------------------------------------------     -A INPUT -i lo -j ACCEPT     -A OUTPUT -o lo -j ACCEPT          # Allow packets from internal network to reach external network.     # if eth1 is connected to external network (internet)     # if eth0 is connected to internal network (192.168.1.x)     #---------------------------------------------------------     -A FORWARD -i eth0 -o eth1 -j ACCEPT          # Allow outbound DNS     #---------------------------------------------------------     -A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT     -A INPUT -p udp -i eth0 --sport 53 -j ACCEPT          #---------------------------------------------------------     # DATABASE Connections     #---------------------------------------------------------     # Allow MySQL connection only from a specific network     #---------------------------------------------------------     -A INPUT -i eth0 -p tcp -s 192.168.200.0/24 --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT     -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT                    #---------------------------------------------------------     # SSH     #---------------------------------------------------------     # Allow ALL incoming SSH     #---------------------------------------------------------     -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT     -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT          # Allow outgoing SSH     #---------------------------------------------------------     -A OUTPUT -o eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT     -A INPUT -i eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT          # limit ssh to 10 connections in 10mins         # note 198.255.255.255 is fake for this post     #---------------------------------------------------------     -I INPUT -p tcp -s 0/0 -d 198.255.255.255 --sport 513:65535 --dport 22 -m state --state NEW,ESTABLISHED -m recent --set -j ACCEPT     -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 600 --hitcount 11 -j DROP     -A OUTPUT -p tcp -s 198.255.255.255 -d 0/0 --sport 22 --dport 513:65535 -m state --state ESTABLISHED -j ACCEPT               #---------------------------------------------------------     # DoS     #---------------------------------------------------------     # Prevent general DoS attack     #---------------------------------------------------------     -A INPUT -p tcp --dport 22 -m limit --limit 5/minute --limit-burst 10 -j ACCEPT     -A INPUT -p tcp --dport 80 -m limit --limit 5/minute --limit-burst 100 -j ACCEPT     -A INPUT -p tcp --dport 443 -m limit --limit 5/minute --limit-burst 100 -j ACCEPT          # Syn-flood protection     #---------------------------------------------------------     -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT          # Interface 0 incoming syn-flood protection     #---------------------------------------------------------     -N syn_flood     -A INPUT -p tcp --syn -j syn_flood     -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN     -A syn_flood -j DROP          # Furtive port scanner     #---------------------------------------------------------     #-A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST \     #-A port-scan -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j RETURN     #-A port-scan -j DROP               # Ping of death     #---------------------------------------------------------     #-A FORWARD -p icmp --icmp-type echo-request -m limit \ --limit 1/s -j ACCEPT          # Limiting the incoming icmp ping request     #---------------------------------------------------------     -A INPUT -p icmp -m limit --limit  1/s --limit-burst 1 -j ACCEPT     -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:     -A INPUT -p icmp -j DROP     -A OUTPUT -p icmp -j ACCEPT               #---------------------------------------------------------     # Logging     #---------------------------------------------------------     # Log dropped packets     #---------------------------------------------------------     -N LOGGING     -A INPUT -j LOGGING     -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: " --log-level 7     -A LOGGING -j DROP                    COMMIT     # End      I had to remove the `port-scan` and the ping of death rules as it was cause it not to pas the test. I want to correct that too. Any ideas why it would pass the test but hang for ever on applying the rules? **UPDATE** So far commenting everything except               # Allow all traffic.     #---------------------------------------------------------     *filter     :INPUT ACCEPT [81:5076]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [44:3868]      I still was getting odd results like `iptables` hanging while starting back up, to not being able to `yum install *`. At this point it's like I just need to start over on fixing the rules lol.


Installing Aqua interface on Darwin

Is is possible to install the Aqua GUI on top of Darwin? I was researching this about a year and a half ago and I don't remember much about what I found out. I also was not the main person in charge of research, so that didn't help. Anyhow, I can download Darwin from the Apple site, and I get a CLI (kinda like single-user mode for OS X), and I now want to install an interface on top of that.   1. Can I install the Aqua GUI?   2. Or do I have to install another GUI?   3. Would it be possible to write a GUI for it?   4. How would I do this?


How to stop the executing process in Linux

I have a script file pingIP.sh which just pings the given IP address,               ping -c 70 74.125.228.71      The problem is when I try to stop the executed script in the middle its not stopping it properly. Using linux cmd `ps -ef|grep pingIP |grep -v 'grep pingIP'` I'm able to get the process id, and killing it using cmd `kill -9 processid`. For example, executing script file               PING 74.125.228.71 (74.125.228.71) 56(84) bytes of data.     64 bytes from 74.125.228.71: icmp_seq=1 ttl=122 time=256 ms     64 bytes from 74.125.228.71: icmp_seq=2 ttl=122 time=244 ms     64 bytes from 74.125.228.71: icmp_seq=3 ttl=122 time=250 ms     64 bytes from 74.125.228.71: icmp_seq=4 ttl=122 time=254 ms     64 bytes from 74.125.228.71: icmp_seq=5 ttl=122 time=243 ms      Executing the `kill` command now just stops the script execution but ping response is continuing until specified ping count is reached. Any suggestions to avoid the ping execution even after stopping the execution of script file?


Symbolic Link local .jpg file to .jpg file on the internet

Is there any way to have a symbolic link that links a local .jpg file to a .jpg file on the internet in a l/unix environment?


SSH tunnel to router periodically hangs. TCP problem?

Something weird I've noticed since upgrading my office router to the Buffalo WZR-HP-G300NH. When I remote in using an SSH tunnel, the tunnel will "freeze" pretty often. The freeze lasts 1-2 minutes each, after which all the traffic that was stuck catches up. It's very annoying to be using VNC and have the session pause every few minutes. I am using the following command from my local machine:               ssh -D 9000 root@my.router.hostname       I know the whole router isn't freezing because I can open another SSH session and it's fine -- until it freezes, too. The freezing sessions are independent of each other. Both will periodically freeze, but not at the same time. I can start a ping going in both sessions and neither loses a single packet or even shows any lag, even though the both freeze a couple times. If I forward the VNC port straight through to the remote machine, the problem gets somewhat better leading me to believe this is more likely a TCP issue rather than SSH. But I'm not ruling anything out. This behavior has persisted despite upgrading firmwares to the latest dd-wrt, including the build that was pulled a few weeks ago. Is it a problem with dropbear? Or with MTU? QoS?


Cannot start xterm over ssh after several successes

I am running some MATLAB scripts on the command-line of a remote computer using `ssh`. These scripts launch 5 `xterms` that are forwarded to me via ssh (using the `-X` option). At the moment I am debugging my code so I am restarting my scripts every now and then. Everything works fine for a couple of runs, but after the N'th time (where N is a random number) I get theses error messages:               xterm Xt error: Can't open display: localhost:10.0     xterm Xt error: Can't open display: localhost:10.0     xterm Xt error: Can't open display: localhost:10.0     xterm Xt error: Can't open display: localhost:10.0     xterm Xt error: Can't open display: localhost:10.0      After this I can continue to use ssh except for starting anything GUI-related, meaning that I can no longer start `xterms` remotely. My only workaround is to restart the ssh connection. Can I fix this somehow to never be bothered again by this? **System**   * local system: privately owned laptop, running Chakra Linux, KDE   * remote system: university computer, running openSuSe, KDE


How to update ubuntu repositories?

I've just downloaded Bodhi Linux which is built on ubuntu 10.04 LTS. ubuntu 10.04 packages seems outdated and i cannot install newer versions of my packages. for example i need to install g++4.6 (to use some c++0x features) but i'm just able to install g++4.4. I added all backport repositories but they had no actual effect on version of packages. what should i do, can i add ubuntu natty's repositories to my software cources?


Configuring what commands xfce4-session-logout runs

The suspend command run when selecting ‘suspend’ from xfce4-session-logout does not work on my machine. I need it to run `s2ram -f -a 1`. Where do I change what is being run to suspend the system?


Detection of USB Modem is unstable - how can I correct this?

I am using Huawei 3G USB Modem in Ubuntu 12.04 LTS on DELL Inspiron NS5520. I tried every possible solution but had no luck. Whenever my USB Modem disconnects, I can not re-connect it and then I have to restart laptop. On restart, sometimes it detects the USB Modem and sometimes not. In Ubuntu 11.x It was working fine, but now I am using 12.04. This is the lsusb ouput:               Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 003 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem     Bus 001 Device 003: ID 0bda:0129 Realtek Semiconductor Corp.      Bus 001 Device 004: ID 0c45:648d Microdia      Bus 002 Device 003: ID 8087:07da Intel Corp      Any help will be greatly appreciated.


Is there a FUSE which permits transparently accessing incremental backups?

While _creating_ incremental backups is relatively simple (and can be automated, e.g. via `rdiff-backup`), in order to access a specific state of a file one first has to manually restore the backup, which is both not-simple and tedious if you need to browse through multiple states. So is there a FUSE which allows to transparently access previous states e.g. via some `filename@2013-01-23` (the backup made at that date, if existing) or `filename@{-2}` (two backups ago) syntax while the current and backup files reside on arbitrary filesystems (including remote ones, e.g. nfs backups while the current state is on a local ext3)?


Is there a Linux deep diff tool that also compares file attributes?

Is there a Linux tool like diff that will recursively compare files and directories, but with the addition of also comparing: extended attributes, acl's, se contexts?


Mac Firebreath plugin port to Linux (dependencies)

I have Firebreath plugin for Mac that I need to port to Linux. I am trying to find the replacement dependencies for the Linux version. Here is the dependencies I have in my `cmake` for Mac:               find_library(COCOA_F Cocoa)      find_library(FOUNDATION_F Foundation)      find_library(APPKIT_F AppKit)      find_library(COREDATA_F CoreData)      find_library(AGL_F AGL)      find_library(CARBON_F Carbon)      find_library(AUDIOTOOLBOX_F AudioToolbox)      find_library(COREAUDIO_F CoreAudio)      find_library(AUDIOUNIT_F AudioUnit)      find_library(QUARTZCORE_F QuartzCore)      find_library(QUICKTIME_F QuickTime)      find_library(OPENGL_F OpenGL)      find_library(QTKIT_F QTKit)      So far I've found:               OpenGL       => freeglut3 ?     Cocoa        => GLFW ?      Any suggestions for the other dependencies?


I cant save files in /var/www/html

I'm running Centos 6.5 and I'm having problems saving my files to `/var/www/html`. The folder currently belongs to `root` and I have gone through everything from SELinux to configuration procedures, but I hardly understand those procedures. I believe the permission restriction is also preventing me from viewing my local web pages in the web browser. I want to be able to move files to and from the `/var/www/html` folder without restrictions.


Dunst notifier on CentOS

I need a notifier such that:   1. It is possible to send messages from one machine to another without any password (like in case of notify-send). Correct me if I'm wrong.   2. It is such that only when a user clicks on cross button that it closes. I found Dunst while searching. it needs basic packages.               dbus     libxinerama     libxft     libxss     libxdg-basedir      out of which, I'm not able to get `libxdg-basedir` installed on my system. I tried searching for it, but there aren't any packages available for CentOS. Question: is it possible to compile and install Dunst (or a notifier) on CentOS? If so how?


Ping command results in packet loss

Whenever I `ping` on my personal computer, nothing gets displayed other than a single statement. Upon stopping execution, I see that several packets were transmitted in the statistics. On top of all this, I'm getting a rather absurd packet loss. What can I do to make `ping` react in a sane manner? I am running **Centos 6.5 64bit**. Below is an example output when I try `ping google.com`:               [root@Virus os]# ping google.com     PING google.com (74.125.230.160) 56(84) bytes of data.     ^C     --- google.com ping statistics ---     5 packets transmitted, 0 received, 100% packet loss, time 4274ms      `ifconfig -a`:               [root@Virus os]# ifconfig -a     eth0      Link encap:Ethernet  HWaddr B4:B5:2F:29:FE:D7                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:108 errors:0 dropped:0 overruns:0 frame:0               TX packets:108 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:9081 (8.8 KiB)  TX bytes:9081 (8.8 KiB)          wlan0     Link encap:Ethernet  HWaddr 84:4B:F5:14:9B:58                 inet addr:172.20.40.55  Bcast:172.20.255.255  Mask:255.255.0.0               inet6 addr: fe80::864b:f5ff:fe14:9b58/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:56944 errors:0 dropped:0 overruns:0 frame:0               TX packets:40200 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:55308863 (52.7 MiB)  TX bytes:6291284 (5.9 MiB)      `iptables -L`:               [root@Virus www]# iptables -L     Chain INPUT (policy ACCEPT)     target     prot opt source               destination              ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED      ACCEPT     icmp --  anywhere             anywhere                 ACCEPT     all  --  anywhere             anywhere                 ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh      REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited           Chain FORWARD (policy ACCEPT)     target     prot opt source               destination              REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited           Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination       `netstat -nr`:               [root@Virus www]# netstat -nr     Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     172.20.0.0      0.0.0.0         255.255.0.0     U         0 0          0 wlan0     0.0.0.0         172.20.4.254    0.0.0.0         UG        0 0          0 wlan0


Running minix3 in virtual box

My host OS is Ubuntu 12.04 32-bit.I want to run Minix 3 in the virtual box from live CD. I followed their instructions to install it, and faced the following error: > Warning:1 module failed to load. What should I do? ![image of minix3 installation problem](http://i.stack.imgur.com/bz4Rp.png)


Expand variable in function definition in zsh

I want to generate a set of functions in my shell in a `for` loop, but I can't see how to access a variable inside the function body of the function I'm creating. In essence, I would like the following               for f in foo ; do $f() { echo $f } ; done      to generate a function `foo() { echo foo }`, but instead I get `foo() { echo $f }`. I've read the section on parameter expansion flags in the zsh manual, but whatever I write after `$f()` seems to be put verbatim into the generated function's body, so I had no luck. Maybe this is the wrong way to do this? If not I want to know how I can expand `$f` inside the function when it's generated.


Permissions for installing programs on Linux

I'm running Linux Mint 16. When trying to install programs in the `usr/local` directory, instead of doing `sudo ./install` for the program, I've been creating the directory, the program wishes to install into, manually in the `usr/local` directory and changing the permissions of this directory, then after it has installed, I change the permissions back to default. I've been doing this so as not to give root access to the program I'm installing for security reasons. Is this really silly and/or damaging or does it matter?


Disable headphone jack detection in pulseaudio

I have a dodgy headphone port on my laptop that does not reliably detect when headphones/external speakers are plugged in. This means that the output is constantly being muted/unmuted which is rather annoying How can I configure pulseaudio to disable the jack detection (or alternatively just force output through this jack)? I assume it'll involve editing analog-output-headphones.conf however I can't figure out how to do so (analog-output.conf.common is of no help).


I can't use the command ftp

When I try to install ftp               [root@localhost bin]# yum install ftp     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Install Process     No package ftp available.     Error: Nothing to do      When I try to connect to my ftp               [root@localhost bin]# ftp 10.2.4.202     -bash: ftp: command not found      with yum               [root@localhost bin]# yum ftp 10.2.4.202     Loaded plugins: fastestmirror     No such command: ftp. Please use /usr/bin/yum --help      yum search ftp               yum search ftp     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     ====================================================================== N/S Matched: ftp ======================================================================     curl.x86_64 : A utility for getting files from remote servers (FTP, HTTP, and others)     wget.x86_64 : A utility for retrieving files using the HTTP or FTP protocols            Name and summary matches only, use "search all" for everything.      yum install lftp, list *ftp*, install ncftp (same results)                yum install lftp     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Install Process     No package lftp available.     Error: Nothing to do      lftp               # lftp 10.2.4.202     -bash: lftp: command not found      yum repolist               yum repolist     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     repo id                                                           repo name                                                                            status     CactiEZ                                                           CactiUsers Cactiez Repo                                                               30     pgdg93                                                            PostgreSQL 9.3 6 - x86_64                                                            195     repolist: 225


Fedora 19: can't disable the firewall

I've installed a server (WSO2 ESB) in my laptop. When I run it, going to the browser and typing the console address `https://10.13.6.75:9443/carbon`, it works normally, but if I try it on another machine on the network, it gives timeout. Some observations:   * ping works   * telnet respond on ssh port (22) but not in 23, 8080, 9443, etc   * I've already executed `service firewalld stop`, `service iptables stop`, and disabled the `selinux`, but no results. There's another process involved blocking the requests?


Specifying height for vertical splits in vim

Usually I am editing two files, A and B, split horizontally. I set it up, so that one buffer would only occupy the first 2 lines at the top of the screen, and the rest is for the other buffer. Sometimes I need to edit a third file, C, which is to have half the screen realestate of the big buffer, split vertically. The following roughly shows what I would like to end up with.               ------------------------------------------------------------------------------     | First  line of file A                                                      |     | Second line of file A                                                      |     ------------------------------------------------------------------------------     | First  line of file C               | First  line of file B                |     | Second line of file C               | Second line of file B                |     |        ...                          |       ...                            |     | Last   line of file C               | Last   line of file B                |     ------------------------------------------------------------------------------      The problem is, that when I do `:vsplit C` to split half of the big buffer off for the new file, vim also resizes the buffer showing file A to eat up half the screen and files B and C each get a quater screen. How do I tell vim to not care about horizontal resizing when doing vertical splits? **EDIT** To be more explicit: I am looking to specify the resulting height of a buffer, when doing a vertical split. The `vsplit` command accepts only width as a parameter, not height. I can resize windows after opening the new file, but that is rather tedious. The problem becomes more difficult with more open files. I could just stick to editing one file at a time, but I think vim is more powerful than that.


iproute command: ip -6 rule show nothing even with kernel option IPV6_MULTIPLE_TABLES=y

I want to enable my linux 3.2.4 to have ipv6 multi-routing table functionality. I enable IPV6_MULTIPLE_TABLES when make menuconfig and rebuild kernel.(Also with ip advanced routing and ip multi table) I use `ip -6 rule`, it still didn't show local and main tables, that is ipv6 multi table didn't work. Did Anyone have encounter the same problems?


Kill any service running at a specific port

I am trying to write a script that kills service running at a specific port. This is my script:               a=$(ps ax | grep 4990 | grep java | awk '{print $1}')     kill -9 $a      It's a java program. This script works sometimes, but mysteriously fails most of the time. Is there any other way to kill a service running on a port? My port is `4990`.


Fluxbox: how to map a key for taking screenshot of selected area?

I want to map the `Ctrl+Alt+4` to take a screenshot of a selected area. Right now I can do that from a terminal using `gnome-screenshot -a`. I have tried putting:               Control Mod1 4 :ExecCommand gnome-screenshot -a`       in my `~/.fluxbox/keys` but that does not work -- probably because of the space before `-a`. Is there a way to map those key combination to take a screenshot of a selected area?


Where to place source code for applications compiled from source?

In the past when I have compiled applications from source I have extracted the source code to `~/src` and compiled from there. I realize now that there may be no need for me to create the `~/src` directory, as Linux probably already has an established location for source code for applications such as this. Is this the case? What is the directory in Linux that is established as the place for source code from third party applications that I want to compile?


Installation of QEMU, GCC for ARM in RHEL

We are setting up a lab which has the QEMU system to emulate an ARM processor and run assembly programs. The lab is currently setup with the host operating system as Ubuntu. We are migrating the lab to RHEL environment. We are going to use RHEL 5.6 version OS. These are the set of software that needs to be installed to make the lab up and running.   * QEMU Emulator - It was fairly straight-forward. I used the command **yum install qemu** and **yum install qemu-kvm** for the virtualization.    * GCC for ARM - I am actually stuck in this process. I downloaded the gcc arm from this link. I used the command, **tar xjvf gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2** to extract the file and install it. However, after installation if I run the command, **arm-none-eabi-gcc --version** it is not giving me the version but an error saying command not found.    * GDB communicating with the QEMU/ARM program being executed.  What am doing wrong in the installation process? EDIT: The contents of the tar ball after extraction are as below. There are 5 folders named,   * arm-none-eabi   * bin   * gcc- arm-none-eabi-4_7-2013q2   * lib   * share


Reasonable literature on network printing (protocols)

I need some recommendations on reasonable and up-to-date literature about network printing, the corresponding protocols (ipp, lpdp, ...), printjob authentication and accounting in heterogenous networks.


Pidgin replace my symlinks

If I move the settins.xml (or any other file) from the `.purple` folder into another place and create a symlink to this file instead, it gets replaced by regular files after a restart of pidgin. I want to put some configuration files into a git repository and put symlinks to it. That worked on all other programs but pidgin seems to delete the symlinks.               cd .purple     mv settins.xml ../     ln -s ../settings.xml          ls -l settings.xml     settings.xml -> ../settings.xml      restart pidgin               ls -l settings.xml     settings.xml      Why is that happening and what can I do to prevent this behaviour?


In bash, how can I echo the variable name, not the variable value?

Suppose that I have a variable `var` in bash. I can assign a value to it. For example, I will make it a string:               var="Test"      I want to `echo` the name of `var`, not the value held by `var`. (I can do the latter with `echo $var`, but I actually want to do the former.) The answer to this question from SO says to use `echo ${!var}`, but when I do that I echo just returns a blank line. For example, this bash script               #!/bin/bash          echo "Hi"     var="Test"     echo ${!var}     echo "Bye"      returns this output:               Hi          Bye      with just a blank line between **Hi** and **Bye** , instead of **var**. What am I doing wrong? I'm running **bash 4.1.5(1)** on **Ubuntu 10.04.4**.


Wildcards inside quotes

This will be an easy one, but in my memories, when shell scripting, using double quotes would allow expanding globbing and variables. But in the following code:               #!/bin/sh          echo *.sh     echo "*.sh"     echo '*.sh'          echo $LANG     echo "$LANG"     echo '$LANG'      I get this result:               bob.sh redeployJboss.sh     *.sh     *.sh     en_US.utf8     en_US.utf8     $LANG      So single quoting prevent glob AND variable expansion but double quoting allows only variable expansion and no globbing? Can I glob in any quoting pattern?


Grep log and get text between log delimiters

Is there a way to `grep` a log and find text between the log entry delimeters? Our log file separates the line entry with characters "`-------`" So when I search the text word I want all the lines before and after the delimeters in the log. Sample log               ------------------------------------------------------------------------              r132279 | USERID | 2014-04-30 12:59:09 -0700 (Wed, 30 Apr 2014) | 3 lines         Removed unused "Calculated Fields" column entry.         Jira ID: JIRA-977          ------------------------------------------------------------------------      In the above i would Grep the word Fields but want all the lines between the "`----`" lines


Missing Messages and Secure logs files on CentOS

I'm having troubles with CentOS release 6.4 (Final). I'm looking for log files in `/var/log/` and I'm obviously missing two files:   * `/var/logs/messages`   * `/var/log/secure` I was checking if rsyslog is running (`service rsyslog status`) and it's _OK_. My rsyslog config file is called `/etc/rsyslog.conf`, folder `/etc/rsysconf.d/` is empty. Can anyone shed some light on what's going on?


How to return from root log-in to my user log-in?

I'm using SuSE Linux Enterprise and I know that there is a command               su root      for changing to root log-in. But what about the other way around? If I prefer to return to my user account, how to do it?


How can I delete a file with no name

I somehow managed to create a file that doesn't seem to have a filename. I found some information regarding how to get more details of the file in the following thread. However, I tried some of the suggestions listed and can't seem to delete the file. I'm not sure what I did to create it, but it happened while trying to copy an xml file. Any ideas are appreciated. Some info on the file is as follows;               > ls -lb     total 296     -rw-r--r--   1 voyager  endeavor  137627 Jan 12 12:49 \177          > file *     :               XML document          > ls -i      417777         I tried to find using the inum switch and then pipe that to rm as that seemed like the most foolproof way of getting rid of it. However, the example given at the bottom of the thread linked below failed for me. Example was;               > find -inum 41777 -exec ls -al {} \;     find: illegal option -- i     find: [-H | -L] path-list predicate-list      so I tried using the path list first like the following, but that didn't work either;               > find . -inum 41777 -exec ls -al {} \;      Any help on how to remove this file is appreciated. I'm not sure what the non- printable character \177 is or how I can pass that to an rm command, but I really want to make sure I don't mess up any other files/directories in my attempt to delete this file. Thanks.


How to recursively synchronize file timestamps across servers?

Suppose I run an rsync command to mirror a server, but forget to supply the -t option. The mirror will now have different timestamps to the original. What is the easiest way to fix this, without transferring all the files all over again?


How to set parameter i486 on glibc compiling process of x86_64 system?

My host:                 lfs@sam:/mnt/lfs/sources/glibc-build$ uname -m       x86_64       lfs@sam:/mnt/lfs/sources/glibc-build$       In lfs(LFS-BOOK-6.8-HTML/chapter05/glibc.html) It says                 case `uname -m` in         i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;       esac      What I should change on 'i?86'? And should I change 'i486'? Thank you~


Resolve filename from a remote URL without downloading a file

I am creating a script, which should download latest version of an application from repository and deploy the app. The main issue: there are several repositories and I need to check, which of them has most recent version. E.g.               http://repo1/xyz/LATEST -> (redirects to) -> http://repo1/xyz/app-1.0.0.0.zip     http://repo2/xyz/LATEST -> (redirects to) -> http://repo1/xyz/app-1.1.0.0.zip      So I need to iterate over available repositories and get only a filename - no need to download obsolette versions of software.


How to find out that someone is using a Keylogger on the machine I am using?

HW/SW/whatever keyloggers are there. How to find out? E.x.: Regularly check the cable of the keyboard, because there could be HW keyloggers: http://i.imgur.com/TeMwo.jpg But what about other HW keyloggers, or Software keyloggers? [Using a Linux, e.x.: Fedora or Ubuntu for OS!] - How to track keylogger softwares/solutions? What are the "best-practises?


Uppercase input turns on periodically

I have some problem. Every 3-5 second everything, that I input from keyboard became **UPPERCASE** only. I also have two keyboard layouts: **us** and **ua**. And when uppercase happens - I can't switch my keyboard layout (I use mod4 for switching). This is my xmodmap output:               $ xmodmap     xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):          shift       Shift_L (0x32),  Shift_R (0x3e)     lock        Caps_Lock (0x42)     control     Control_L (0x25),  Control_R (0x69)     mod1        Alt_L (0x40),  Meta_L (0xcd)     mod2        Num_Lock (0x4d)     mod3           mod4        Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)     mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)      I tried `xmodmap -e "clear lock"`, but uppercase input still periodically turns on. I tried to disable Caps Lock key in "hardware way", putting insulator between keyboard contacts. But I doesn't help. _== Update ==_ For **A#1**   Look, there is sticky Caps_Lock:               KeyPress event, serial 40, synthetic NO, window 0x2a00001,         root 0xaa, subw 0x0, time 30893676, (-254,229), root:(384,359),         state 0x2, keycode 39 (keysym 0x53, S), same_screen YES,         XLookupString gives 1 bytes: (53) "S"         XmbLookupString gives 1 bytes: (53) "S"         XFilterEvent returns: False      What I'm doing? **First** , I run `florence` (Virtual Keyoards) and turn off Caps_Lock key. **Second** , I type: `xmodmap -e "clear lock"`. But it is very dirty hack :), you know. It works for few minutes or few hours.


Current pending sector count error

Recently my hard disk show some error message in _SMART_ utility, I have taken a screenshot from error messages. That's something like : _Current pending sector count error_ && _Relocated sector count_ . Can someone explain me how to fix such Bad Sector and Errors ? ![enter image description here](http://i.stack.imgur.com/nYiwC.png) ![enter image description here](http://i.stack.imgur.com/uLGYl.png) notice : Sometimes system hangout and syslog show " _Kernel:Journal commit I/O error_ "


Mutt multi content type

Good afternoon I want to send multiple content_type with mutt. Can I do that? Here is my code :               mutt -e "set content_type=text/html" -e "set content_type=text/plain" someone@mail.com -s "Multi content_type" < body.html body.txt      I mean, I have 2 version of email body, body.html and body.txt What I want is, send both of them in same time but when someone read it, it only read one of each version. If his/her email client doesn't support html, he/she read text version instead of html version.


How to pass the output of a script to a command like ls without the output being split?

Suppose I have a script like this:               #!/bin/bash     printf '%q\n' "b c"      Executing the script prints:               b\ c      on the commandline. Now, being in a directory which contains a file named `b c` I want to pass the output of my script to a command like `ls`:               $ ls $(./myscript)      The problem here is that `b c` is split to `b\` and `c`, i.e. two arguments, and `ls` of course cannot find them. Is there some way to circumvent this? I thought escaping the space in the output would be enough.


How can I load the right hand pane of vim with a new file in linux?

I want to compare two files(say `A` and `B`) side by side(vertically) in in Vim. I open one of those two files(say A) and as per this answer in this site issue a `Ctrl+w v` . Now both the panels are showing contents of file `A`. How can I see the contents of A in the left had side and B in the right hand side ? I am using Red Hat Linux if that matters .


How to write in directory out of home?

I have my Apache server running in the `/srv/http/` directory. I changed the group of it to `httpadmin` and then added my user to that group. Then, I changed the permissions of that directory to `rwxrwxr-x`, which means everyone in the group `httpadmin` should be able to write in that directory, right? Yet, I can't create files in it. What am I missing?


Data extraction of entire DB on SCO Openserver 6

Firstly apologies if this question seems like a wall of text, I can't think of a way to format it. I have a machine with valuable data on (circa 1995), the machine is running UNIX (SCO OpenServer 6) with an unknown database stored on it. The data is normally accessed via a software package of which the license has expired and the developers are no longer trading. The software package connects to the machine via telnet to retrieve data and modify data (the telnet connection no longer functions due to the license being changed). I can access the machine via an ODBC driver (SeaODBC.dll) over a network, this was how I was planning to extract the data but so far I have retrieved 300,000 rows in just over 24 hours, in total I estimate there will be around 50,000,000 rows total so at current speed it will take 6 months! I've played around with the UNIX interface and the only large files I can find are in a massive matrix of single character folder (eg A>G>data, A>H>data ect). I need either a quicker way to extract the data from the machine via ODBC or a way to extract the entire DB locally on the machine to an external drive/network drive or other external source. Does anyone know how to find out the installed DB systems on the machine? Hopefully it is a standard and I'll be able to find a way to export everything into a nicely formatted file!


Debian - enable broadcom wireless controller

Ok, this is driving me crazy. I'm setting up an old Dell Precision M60 notebook, and I can't manage to enable support for its wireless device on debian squeeze. What I tried:               lspci | grep -i wireless         02:03.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 02)      nice. I found this page on debianwiki: bcm43xx. First of all, let's check if the device is really supported.               lspci -vnn -d 14e4:         02:03.0 Network controller [0280]: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller [14e4:4320] (rev 02)             Subsystem: Dell TrueMobile 1300 WLAN Mini-PCI Card [1028:0001]             Flags: bus master, fast devsel, latency 32, IRQ 5             Memory at fafec000 (32-bit, non-prefetchable) [size=8K]             Capabilities: <access denied>             Kernel driver in use: b43-pci-bridge      so it's [14e4:4320] (rev 02). And yes, it's supported. Back to the debianwiki page " For 802.11b-only devices (BCM4301) or **802.11b/g devices with the BCM4306 revision 2 chipset, install firmware-b43legacy-installer** " let's try:               sudo aptitude install firmware-b43legacy-installer       ..                firmware-b43legacy-installer     E: Sub-process /usr/bin/dpkg returned an error code (1)     A package failed to install.  Trying to recover:     Setting up firmware-b43legacy-installer (4.178.10.4-4) ...     Not supported card here (PCI id 14e4:165     14e4:4320)!     Use b43 firmware. This is just for the b43legacy driver.     Aborting.     dpkg: error processing firmware-b43legacy-installer (--configure):      subprocess installed post-installation script returned error exit status 1     Errors were encountered while processing:      firmware-b43legacy-installer     Setting up firmware-b43legacy-installer (4.178.10.4-4) ...     Not supported card here (PCI id 14e4:165     14e4:4320)!     Use b43 firmware. This is just for the b43legacy driver.     Aborting.     dpkg: error processing firmware-b43legacy-installer (--configure):      subprocess installed post-installation script returned error exit status 1     configured to not write apport reports                                           Errors were encountered while processing:      firmware-b43legacy-installer     E: Sub-process /usr/bin/dpkg returned an error code (1)     A package failed to install.  Trying to recover:     Setting up firmware-b43legacy-installer (4.178.10.4-4) ...     Not supported card here (PCI id 14e4:165     14e4:4320)!     Use b43 firmware. This is just for the b43legacy driver.     Aborting.     dpkg: error processing firmware-b43legacy-installer (--configure):      subprocess installed post-installation script returned error exit status 1     Errors were encountered while processing:      firmware-b43legacy-installer      What? Let's try with the firmware-b43-installer               aptitude install firmware-b43-installer      It works. But:               sudo iwconfig              wlan0 IEEE 802.11bg  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off          sudo ifconfig wlan0 up         SIOCSIFFLAGS: No such file or directory      Again? I googled the error and it is related to the firmware, but i Installed it! I already checked in `lib/firmware`, there's a b43 folder with the .fw files Any idea?


Reinstall versions of software not found in repositories

I recently installed the utouch-daily PPA, and it's given me some problems. How can I revert to the packages available in the default repository? I've removed the repository from `/etc/apt/sources.list.d`, now how can I revert to the ones now available from the other normal repositories available on my system?


Connecting to localhost via system IP address

I am using Linux Mint 15, and I am running a Ruby web server(Thin) on port 3000. I can connect from my machine via `localhost:3000`, but the moment I type in the system IP address (eg. `http://192.168.43.250:3000`) (that I get from `ifconfig`), then I get a 'Webpage not available' message. I would like to connect to my web server via a tablet over a wi-fi connection for testing purposes so I need to be able to connect via the system IP address. What am I missing here?


Will I have to wipe my disk if I install linux?

It might be dumb question, but I want to experience Linux standalone and want to replace my windows 7 with it. My question is: Will I have to wipe my whole data If I install Linux on my notebook replacing windows?


Note taking app that can sync both android and Linux

I've been looking high and low for an Evernote alternative for Linux. I know I can use Everpad or Evernote in WINE but they don't work natively. Any note-taking app would be fine as long as it can sync my android and my linux.


debian X Xconf resolution xrandr badmatch

Recently I minimal installed debian squeeze(amd64), when I configs my resolution, unexpected errors came out, I did a lot of searching, but couldn't find a way to figure it out.   1. to install the desktop environment: `apt-get update`, `apt-get install xorg-core xserver-xorg-core gnome-core gdm3`   2. to install graphic grivers `apt-get install build-essential nvidia-kernel-common linux-headers-$(uname -r)`, `./NVIDIA-Linux-x86_64-304.64.run` steps above seems all things is in the correctly way.   1. to set resolution : `cvt 1440 900`, `xrandr --newmode xxx`, `xrandr --addmode VGA-0 xxx` then I got that error: > X Error of failed request: BadMatch (invalid parameter attributes) Major > opcode of failed request: 153 (RANDR). Minor opcode of failed request: 18 > (RRAddOutputMode). Serial number of failed request: 29. Current serial > number in output stream: 30. I don't know what information U need, and just list some graphic card: nvidia gt630. monitor: phlips 190cw(1440x900, works well on windows) `xrandr` out put               Screen 0: minimum 8 x 8, current 1280 x 1024, maximum 16384 x 16384     DVI-I-0 disconnected (normal left inverted right x axis y axis)     VGA-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm        1280x1024      60.0*+   75.0          1024x768       75.0     70.1     60.0          800x600        75.0     72.2     60.3     56.2          640x480        75.0     72.8     59.9       DVI-I-1 disconnected (normal left inverted right x axis y axis)     HDMI-0 disconnected (normal left inverted right x axis y axis)       1440x900_60.00 (0x29f)  106.5MHz             h: width  1440 start 1528 end 1672 total 1904 skew    0 clock   55.9KHz             v: height  900 start  903 end  909 total  934           clock   59.9Hz      `lshw -c video` out put               *-display                       description: VGA compatible controller        product: nVidia Corporation        vendor: nVidia Corporation        physical id: 0        bus info: pci@0000:05:00.0        version: a1        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress vga_controller bus_master cap_list rom        configuration: driver=nvidia latency=0        resources: irq:16 memory:f6000000-f6ffffff memory:e0000000-efffffff(prefetchable) memory:f0000000-f1ffffff(prefetchable) ioport:d000(size=128) memory:f7000000-f707ffff(prefetchable)      xorg.conf               Section "ServerLayout"         Identifier     "Layout0"         Screen      0  "Screen0"         InputDevice    "Keyboard0" "CoreKeyboard"         InputDevice    "Mouse0" "CorePointer"     EndSection          Section "Files"     EndSection          Section "InputDevice"         # generated from default         Identifier     "Mouse0"         Driver         "mouse"         Option         "Protocol" "auto"         Option         "Device" "/dev/psaux"         Option         "Emulate3Buttons" "no"         Option         "ZAxisMapping" "4 5"     EndSection          Section "InputDevice"         # generated from default         Identifier     "Keyboard0"         Driver         "kbd"     EndSection          Section "Monitor"         Identifier     "Monitor0"         VendorName     "Unknown"         ModelName      "Unknown"         HorizSync       30.0 - 83.0         VertRefresh     55.0 - 75.0         Option         "DPMS"     EndSection          Section "Device"         Identifier     "Device0"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"     EndSection          Section "Screen"         Identifier     "Screen0"         Device         "Device0"         Monitor        "Monitor0"         DefaultDepth    24         SubSection     "Display"             Depth       24         EndSubSection     EndSection      * * * **update** : I trid to get edid: `apt-get install read-edid`, `sudo get-edid | parse-edid` but got this error:               get-edid: get-edid version 2.0.0              Performing real mode VBE call         Interrupt 0x10 ax=0x4f00 bx=0x0 cx=0x0         Function supported         Call successful              VBE version 300         VBE string at 0x11100 "NVIDIA"          VBE/DDC service about to be called         Report DDC capabilities              Performing real mode VBE call         Interrupt 0x10 ax=0x4f15 bx=0x0 cx=0x0         Function supported         Call successful              Monitor and video card combination does not support DDC1 transfers         Monitor and video card combination does not support DDC2 transfers         0 seconds per 128 byte EDID block transfer         Screen is not blanked during DDC transfer          Reading next EDID block          VBE/DDC service about to be called         Read EDID              Performing real mode VBE call         Interrupt 0x10 ax=0x4f15 bx=0x1 cx=0x0         Function supported         Call failed          The EDID data should not be trusted as the VBE call failed     Error: output block unchanged      * * * **update** I tried to force the resolution to 1440x900 by using `nvidia-settings`, after reboot, resolution changed to 1440X1024(nvidia-settings added a line to xorg.conf `Option "metamodes" "1440x1024 +0+0"`). screen become horizon- scrollable like that: ![enter image description here](http://i.stack.imgur.com/AWe06.png) I also tried to extract `edid.bin`(by using nvidia-settings) and add `Option "CustomEDID" "DFP-1:/etc/X11/edid.bin"` at `Section "Device"` to xorg.conf. thanks to the awesome post `Fixing Ugly DVI/HDMI Displays due to EDID bugs on nVidia drivers`, but unfortunately it doesn't work either. Any help is greatly appreciated. Thank you


fail2ban log parsing too slow on Raspberry Pi - options?

I'm running fail2ban on a Raspberry Pi at 950MHz which I cannot overclock further. The Pi is occasionally subject to SYN floods on particular ports. I've set up iptables to throttle the rate of SYNs on the port of interest; when the throttle limits are exceeded, hosts which send SYNs are dropped into the REJECT chain and the particular SYN packet which exceeded the limit is logged. fail2ban then watches for these logged SYNs and, after seeing a few, temporarily bans the host for a short time (this is a transient issue in the app I'm working with). The problem is that the SYN floods can occasionally reach rates which are too fast for fail2ban to keep up with; I'll see 20-40 log messages per second, and eventually fail2ban falls behind and becomes ineffective. To add insult to injury, it continues consuming a LOT of CPU as it tries to catch up. I have verified that DROP chained packets from hosts already banned by fail2ban are _not_ logged, and thus do not add to its load. What are my options here? I have a few ideas, but no clear path forward.   1. Could I make the log-parse regex "easier" so it takes fewer cycles? Would using iptables --log-prefix to put a token near the start of the log message, and/or otherwise simplifying/altering the fail2ban regex help? Here is the current fail2ban config line containing a regex:   `failregex = kernel:.*?SRC=(?:::f{4,6}:)?(?P<host>[\w\-.^_]+) DST.*?SYN`   2. Is there a faster way for fail2ban to watch for the packets exceeding the limits than parsing kern.log?   3. Could fail2ban be run under PyPy instead of CPython with minimal nonstandard wizardry (the OS is Raspbian 7, so, mostly Debian 7)?   4. Is there something better than fail2ban that I could use to watch for the packets which exceed the SYN limits, and after N exceeds in X seconds, temporarily put the offending IP into the iptables DROP bucket, and take it out when the ban timer expires? Again, I'd vastly prefer a solution that uses as much software available in Debian as possible, though I can build Debian packages in a pinch.


Setting group permission on directory

I'm looking for the best way to give a group permission to view any files in /var/log, but only using cat or tail. My best guess right now is that I need to use ACL's:                setfacl -mR default:g:group:4 /var/log      Not sure how to limit them only to using cat or tail. Thanks for any suggestions.


Why VNC not showing actual Remote Desktop

Ok i installed vnc server on RHEL 5.9 and also installed Tightvnc viewer on windows 7 and from RHEL i started vncserver and assigned the password using vncpasswd. Then from tightvnc viewer i gave the IP and listening port xxx.xxx.xxx.xxx:1. It successfully connected with VNC server installed and running on RHEL. And then I gave the password and then BOOOM it gave me this hideous interface ![enter image description here](http://i.stack.imgur.com/TgSeX.png) When Actual Desktop is like this ![enter image description here](http://i.stack.imgur.com/b6Z1v.png) Ok people tell me what Im missing


Why setuid does not work on executable?

I know that enabling setuid on scripts has security issues and so is inactive by default, but expect that it works for executables. I created and executable which shows uid as an output following instructions described in this post: Allow setuid on shell scripts But it returns same uid (1000) both before and after running`sudo chmod +s ./setuid-test`. I think this means that setuid does not have any effects on my executable, why and how to solve? The source code:               #include <stdio.h>     #include <unistd.h>     int main(int argc, char** argv) {         printf("%d", geteuid());         return 0;     }      Built and run with               $ gcc -o setuid-test setuid-test.c     $ ./setuid-test     1000     $ sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test     $ ./setuid-test     1000      When running `ls -la`, this is what I get:               me@me:~$ ls -la setuid-test     -rwsrwsr-x 1 nobody me 8572 Aug 19 16:39 setuid-test


Rebuilding sendmail on FreeBSD application server after adding new activedirectory domain controller to network

In the process of adding a new ActiveDirectory domain controller to our network, we decided to rename the domain from "domain.local" to "domain.priv." I scoured all parts of our application server for instances of "domain.local," replacing them with "domain.priv." I did change hostname and change the content of files in `/etc/mail` which had "domain.local" in them. I also navigated to `/etc/mail` and rebuilt sendmail using `make`. New files with our new domain were generated, which was promising. I then restarted sendmail and sent test emails, but none are being successfully sent. Pertinent entry from `/var/log/maillog`: `Authentication-Warning: server_name.domain.priv: deploy set sender to user@company.com using -f` Which other places on the server could contain the old domain name? What should I configure/reconfigure to ready this application server for the domain name change? At this point I'm not sure if it's sendmail, a DNS issue or simply the contents of some file on the application server Thanks and cheers!


What is needed for a minimal systemd boot to launch getty on a virtual console?

For SysV `init`, I need `/etc/inittab` respawning getty entries, the `/sbin/init` binary, the binaries and shared libraries for the shell, `login`, the `getty`, the PAM/security/shadow stuff, and a few device files. For `upstart` I need pretty much the same requirements, but instead of `/etc/inittab`, I have a few `*.conf` files under `/etc/init`: one *.conf that `start on startup` that sets a runlevel with `telinit`, and one *.conf for each tty that start/respawn `getty` on that tty on the appropriate runlevels. What configuration and binaries do I need for `systemd` `init`? The documentation I find all seems to be focused on how to use an already- installed system to start and stop services. A minimal list of files to copy (except the kernel/initrd) from a running _Arch_ or _fedora_ installation would do fine, but I cannot seem to find that kind of information about `systemd`. * * * What I would like to know is, for `systemd`, what files are required, and what must they contain, to start a login shell after an initramfs does it's `switch_root` call to the `systemd` `/sbin/init`. * * * Example for `upstart`, the binaries and two `*.conf` files: File `/etc/init/whatever.conf`:               start on startup     emits runlevel     task     script       telinit 2     end script      File `/etc/init/tty1.conf`:               start on runlevel [12345]     respawn     exec /sbin/agetty -8 --noclear 38400 tty1 linux      * * * Example for `sysvinit`, the binaries and 1 conf file named `/etc/inittab`:               id:2:initdefault:     c1:12345:respawn:/sbin/agetty 38400 tty1 linux      * * * Now I'm after the `systemd` equivalent. I assume at least 1 `*.service` file is needed somewhere, with a `[Service]` entry containing `ExecStart=-/sbin/agetty --noclear %I linux` and `Restart=always`, but what else is needed?


Install new most recent python package in ubuntu?

I could really do with installing matplotlib 1.1.0 on my ubunutu 11.10 system. The current ubuntu package is at 1.0.1, how do I use the new one?


In Debian based systems, how do we purge configuration files of packages that have already been uninstalled?

To be more specific, I would like to do the equivalent of adding the `--purge` flag to the following command               sudo apt-get autoremove --purge [package name]      to packages that are no longer on the system. Preferably, I would like to know how to do it to specific packages and to every uninstalled package in the system.


bash_completion rule for resolving ip into hostnames

I am trying to create a `bash_completion` rule for my script `rmpxe`. This script takes `<hostname>` as its only argument. It then resolves this hostname into `<ip_address>` and removes the corresponding symlink `/srv/tftp/pxelinux.cfg/<ip_address>`. The ip address `<ip_address>` in the symlink `/srv/tftp/pxelinux.cfg/<ip_address>` is in hex format, but I have written a simple program in C (`getnameinfo`) which resolves this hex ip address into hostname. Thus, I can use my program `getnameinfo` to get hostname from hex ip:               $ getnameinfo 0A6F010B     server1.mydomain.com      So for example, following command would delete the symlink `/srv/tftp/pxelinux.cfg/0A6F010B`                $ rmpxe server1.mydomain.com      Now to my `bash_completion` problem: I have created following code which works fine, except that instead of completing hostnames (as my script expects) it completes hex IP addresses (i.e. the symlink files in my directory `/srv/tftp/pxelinux.cfg/`). I need to somehow integrate into this code, that before the argument is autocompleted, it will be first resolved into hostname.               _rmpxe()     {         local word         COMPREPLY=()              if [ 1 -eq "$COMP_CWORD" ]; then           pushd /srv/tftp/pxelinux.cfg &>/dev/null || return 1           word="${COMP_WORDS[COMP_CWORD]}"           COMPREPLY=($(compgen -f "$word"))           popd &>/dev/null         fi          }     complete -F _rmpxe rmpxe      In other words, at the moment my bash completion works like this:               $ ls /srv/tftp/pxelinux.cfg     0A6F010B 0A6F010C 0A6F010D 0A6F010E          $ rmpxe <tab>     0A6F010B 0A6F010C 0A6F010D 0A6F010E      whereas, I need it to work like this:               $ rmpxe <tab>     server1.mydomain.com server2.mydomain.com server3.mydomain.com


How to find responsible script with ausearch results?

So I wanted to know which process is creating a directory ']' in my root. I was assuming this is some typo in some script. So I set up an audit for that directory, very similarly as shown on This question. The next day I checked my logs and found out that the directory has been created again, and it has been logged by audit. But all I can tell from this output, is that _root_ created it. output:               type=SYSCALL msg=audit(26.04.2013 06:25:20.275:85) : arch=i386 syscall=mkdir success=yes exit=0 a0=bfd02ea5 a1=1ed a2=bfd02ea5 a3=bfd025b8 items=2 ppid=24114 pid=24115 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=4294967295 comm=mkdir exe=/bin/mkdir key=weird       Broken to lines :               type=SYSCALL      msg=audit(26.04.2013 06:25:20.275:85) :      arch=i386      syscall=mkdir      success=yes      exit=0 a0=bfd02ea5      a1=1ed a2=bfd02ea5 a3=bfd025b8      items=2 ppid=24114 pid=24115      auid=unset      uid=root      gid=root      euid=root      suid=root      fsuid=root      egid=root      sgid=root      fsgid=root      tty=(none)      ses=4294967295      comm=mkdir      exe=/bin/mkdir      key=weird       I would like to know which script issues this command as root. Is that possible? The process using that PPID is no longer running.


Is it possible to prevent files created being world-readable?

Assume a user uid=1000 and guids=1000,33,277 is allowed to create a file in the folder `/files/`. Is there any way I can prevent that the this user allows others to read the file (which are not at least in the groups 1000, 33 or 277)? Let the file created be `/files/user1000.file` then the question can be specific: Is there a way to prevent this outcome of `ls /files/user1000.file -al`               -rw-rw-r-- 1 1000 1000 6 May 15 17:21 user1000.file      and have this instead:               -rw-rw---- 1 1000 1000 6 May 15 17:21 user1000.file      Maybe using `umask`? I know that there are things like setgid `drw-rws---`, so I'm optimistic there might be a way. Yet I would imagine it is up to the user to decide to do a `chmod o+rw user1000.file`?


Linux Mint 12 two finger scrolling

i can't get two finger scrolling to work for anything on Linux mint 12 64bit.... hp dv7 laptop. the hardware definitely supports it as it works just fine on my windows partition. following the instructions here: http://robert.orzanna.de/2011/06/06/enable- two-finger-scroll-in-linux-mint-11-and-ubuntu-11-04/ i created a /usr/share/X11/xorg.conf.d/50-twofingerscroll.conf file and add the following information:               Section "InputClass"     Identifier "touchpad catchall"     MatchProduct "SynPS/2 Synaptics TouchPad"     MatchDevicePath "/dev/input/event*"     Option "VertTwoFingerScroll" "on"     Option "HorizTwoFingerScroll" "on"     Option "EmulateTwoFingerMinW" "8"     Option "EmulateTwoFingerMinZ" "40"     EndSection      based on this link: http://jaisejames.wordpress.com/2011/11/29/to-enable-touchpad-tap-on-click- two-finger-scroll-in-linux-for-laptop-users/ i also tried a slightly different conf file               Section "InputClass"           Identifier "touchpad catchall"           Driver "synaptics"           MatchIsTouchpad "on"           MatchDevicePath "/dev/input/event*"           Option "HorizScrollDelta" "0"           Option "TapButton1" "1"           Option "TapButton2" "2"           Option "RBCornerButton" "3"           Option "VertTwoFingerScroll" "1"     EndSection      i've also been to Settings > Mouse >Touchpad and enabled two-finger scrolling. this does nothing but kills all scrolling since edge-scrolling is no longer enabled. i've also installed gpointing device settings and tried enabling it that way per the instructions here: http://craiglayne.com/linux-mint-enable-two-finger- scrolling-multitouch/ and i still can't get two finger scrolling to work. this is driving me crazy, not to mention i still have about 2-3 other problems with mint while trying to make the switch away from windows. any further ideas? am i missing something obvious? let me know if you need any more information from me. **edit** : the following terminal commands DO finally enable two-finger scrolling. however, they are lost every time i reboot.               synclient VertTwoFingerScroll=1     synclient HorizTwoFingerScroll=1     synclient EmulateTwoFingerMinW=5     synclient EmulateTwoFingerMinZ=48      I found this xorg configuration that definitely works on my Samsung Series 7 for enabling the clickpad! https://gist.github.com/2382480


Linux Mint - Gnome Shell with dual monitor switch main screen

I have a Lenovo Thinkpad T420 with Linux Mint 12 and gnome-shell on it. Its a Intel HD 3000 Graphics card in there. When I'm at home, I have another Screen plugged in (19" 4:3) and everything works fine (Extended Desktop), except that I would like to have the Gnome 3 Bars + Shell on the right screen. Can't figure out how to do it. Thanks in advance


Losing smtp/pop3/imap access

I have a server running OS X. This server connects to another server, this other one CentOS 6.3, from times to times to collect mail messages over POP3/IMAP and also to send mails using SMTP (exim, on that server). After half a day working well, suddenly this OS X loses the ability to connect using IMAP/POP3/SMTP to the other server over the web but it can access the other server using HTTP/HTTPS/FTP and all other protocols. This OSX server is behind a router installed by the ISP, without a known brand (probably OEM from another company). When the problem happens, I reboot that router and the OSX machine can access the server again. What can be wrong? Is OSX saturating the router for some reason? Is the router broken? How can I trace the origin of this nasty problem?


To env or not to env

What is the difference between the command               $ env FOO=bar baz      and               $ FOO=bar baz      What effect does `env` have?


Grep: search and replace full line

The command                grep "foo" myfile.txt      prints all matching lines in my file. Now I want to replace the **full line** with another string. How can I do that?


How are Flash Videos played?

I was tweaking around with a script for playing Youtube playlists in mplayer. My question is: How does linux play flash videos? My current research yields (By reading scripts written by others): When a video starts buffering, a new folder is created in `/proc/MY_ID/fd` A file is present in that folder with `ls -la` yielding: `lrwx------ 1 username username 64 2012-02-23 21:52 17 -> /tmp/FlashXX6MuuBn (deleted)` Typing `vlc 17` starts playing the video in VLC. I can't understand what is happening. Any suggestions? EDIT: After installing and experimenting, I found the following:   * For my **Chromium** , the MY_ID is one of the PID of `chromium-browse` (there are many)   * For my **Opera** the MY_ID is the PID of `operapluginwrap`   * For my **Firefox** the MY_ID is of `plugin-containe` but this works intermittently. If someone is using Chromium,