Terminal server (ser2net) to configure new HP procurve switch

Switch: HP ProCurve 2910AL-48G - J9147A This switch is brand new straight from HP. Anyone familiar with ser2net for creating a terminal server to connect from usb>serial>console port on a HP procurve switch? I've done this 4 times in the past couple months and had 0 issues. This exact same new one isn't working. Guides I used as a reference:   http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&taskId=115&prodSeriesId=3901671&prodTypeId=12883&prodSeriesId=3901671&objectID=c01975721   http://www.gns3.net/switching-how-to-console-into-your-devices/               root@mycomp:/dev# lsusb     Bus 001 Device 006: ID 0557:2008 ATEN International Co., Ltd UC-232A Serial Port [pl2303]          root@mycomp:/dev# dmesg | grep tty     [ 0.000000] console [tty0] enabled     [ 0.738224] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A     [ 0.963603] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A     [16153.422206] usb 1-1.1: pl2303 converter now attached to ttyUSB0     [18163.982680] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0     [18167.091054] usb 1-1.2: pl2303 converter now attached to ttyUSB0          /etc/ser2net.conf     3002:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner          root@mycomp -> telnet localhost 3002     Trying 127.0.0.1...     Connected to localhost.     Escape character is '^]'.          ser2net port 3002 device /dev/ttyUSB0 [9600 N81] (Debian GNU/Linux)      Then it just hangs there, doesn't take me to a prompt as it did in the past with other brand new switches. If you type anything you get: Connection closed by foreign host. Any ideas on how to troubleshoot this? Also if there is a better way of doing this, feel free to inform me, I have 3 new switches that ideally need to be deployed by end of day tomorrow.


How many times does the same character occur twice in a row

My task is using grep to find how many times the same character occurs twice in a row.   I was thinking about something like this but it isn`t working               grep '[a-zA-z]{2}' *.txt | wc      How can achieve such a task with grep?


PlayOnLinux(POL) Excel 2007 can not open more than one spreadsheet

I have Installed CentOS 6.5 - i386 and PlayOnLinux 4.1. On that `MS Office 2007` is installed. `Word 2007` is able to open more than one document simultaneously and also possible to perform Cut, Copy and Paste between documents. But when I am trying to open more than one spreadsheet using `Excel 2007` whole system becomes unstable. How to resolve this problem?


Gnome 3.10 ScreenCast + Audio on Arch

I'm trying to record my desktop (including audio) in Gnome 3.10 on Arch Linux with the built-in screen recorder (`Ctrl`+`Alt`+`Shift`+`R`). According to this post (and other similar solutions that can be found on the Internet), I've tried to apply the gconf settings               gsettings set org.gnome.shell.recorder pipeline "queue ! videorate ! vp8enc quality=10 speed=2 ! mux. pulsesrc ! audio/x-raw-int ! queue ! audioconvert ! vorbisenc ! mux. webmmux name=mux"      but I get the following error:               No such schema 'org.gnome.shell.recorder'      Browsing with `dconf-editor` I see that `org.gnome.shell.recorder` actually is not there and I couldn't find anything similar... How can I record my desktop in gnome shell 3.10 including internal audio (not mic)? **EDIT:** Also I would like not to include mouse cursor while recording.


How to detect exact spec of my disk on a cloud server?

I've already read a question about whether your disk is SSD or HDD. When I issued the below command I've got surprised:               cat /sys/block/vda/queue/rotational      The output was 1. The question is why it's vda not an sda? And why it says 1? My server is on `DigitalOcean`. They say that all of their disks are SSD! And when I entered the command below:               cat /proc/scsi/scsi      The output was as below, no disk just CD ROM:               Attached devices:                                                                  Host: scsi1 Channel: 00 Id: 00 Lun: 00                                               Vendor: QEMU     Model: QEMU DVD-ROM     Rev: 1.0                                  Type:   CD-ROM                           ANSI  SCSI revision: 05      There is no specification about my disk. How to detect the exact specification of my disk on a cloud server?


Where do my ANSI escape codes go when I pipe to another process? Can I keep them?

I sometime want to pipe the color-coded output fror a process, eg. grep... but when I pipe it to another process, eg. sed, the color codes are lost... Is the some way to keep thes codes intact ? Here is an example which loses the colored output:               echo barney | grep barney | sed -n 1,$\ p


unzip file, which directory was created?

Objective: After expanding archive `a.zip` by using command `unzip` on `Ubuntu 12.10`, assign the name of the folder `a.zip` expanded to to `bash` variable `v`. `a.zip` is assumed and guaranteed to expand to a single folder, rather than multiple folders. Example: If `unzip a.zip` expands to folder `./foo/`, `echo $v` should return `foo`. My environment:               GNU/Linux (kernel 3.5.0-25-generic)     Ubuntu 12.10         bash v4.2.37(1)-release     UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.      * * * Current workaround I am _unhappy_ with: expand via `unzip -d bar a.zip` then `v=$(ls -1 bar)` gives the right result, but messes up the filesystem.


A Linux Distro/Project for Digital Literacy

I am in Africa, and I wish to know if there's any project that introduces Linux/Unix to new users? A project like this one of Microsoft's on Digital literacy.


GID, current, primary, supplementary, effective and real group IDs?

The following links discuss these concepts in different contexts. I have read their definitions, but I still can't tell how they are related, or if some of them are just the same.   * Current group ID   * GID   * Primary and supplementary group IDs   * Effective and real group IDs (also here) ### Here is one example of the source of my confusion: According to (4), If I type `id`, I should get what they call **effective** and **real** group IDs. > $ id uid=501(joe) gid=501(joe) groups=501(joe), 100(users) However, this other link refers to the output of `id` to distinguish between **primary** and **supplementary** ids. Moreover, Wikipedia distinguishes between **primary** vs **supplementary** and **effective** vs **real** group ids. How do these concepts relate to each other? Also, is it true that   * **primary** group id = **GID** = **current** group ID?


How to reinstall apt on Debian?

I accidently removed apt-get from my Debian system by issuing:               dpkg --force-depends --purge apt      How can I reinstall it?


Detecting headphone connection/disconnection in Linux

I am trying to detect a signal when a headphone is connected or disconnected from the system. What is the best way to do this? If there is a special board with drivers, that will be my preferred way.


Restart MySQL server

I am using **MySQL v5.1** on **Ubuntu** machine. MySQL on my machine used to work. (Running `mysql -u root` gave me the MySQL command line.) This afternoon, I did the following thing: **1.** check active process related to '`mysql`' by run:               $ ps aux | grep 'mysql'     mysql  1457  3.3  1.3 130044 27076 ?        Ssl  16:22   0:43 /usr/sbin/mysql      **2.** I saw from above output the PID of the mysql process is 1457, so I killed it with:               $ sudo kill 1457      **3.** now, if I run `$ mysql -u root` , I get an error:               ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)      which is reasonable since I killed the process. How can I have my MySQL server back up and running again after I killed it? I tried to run `sudo /etc/init.d/mysql start`, but my MySQL server does not start. Why is that?


"Packages have unmet dependencies" but I don't want to install these packages anymore. How do I clean this?

You might want to run 'apt-get -f install' to correct these:     The following packages have unmet dependencies:      fglrx-driver : Depends: libfglrx (= 1:14.4.2-1kali1) but it is not going to be installed      gmail-notify : Depends: python-eggtrayicon but it is not going to be installed      libgl1-fglrx-glx : Depends: libfglrx (= 1:14.4.2-1kali1) but it is not going to be installed      libgl1-fglrx-glx:i386 : Depends: libfglrx:i386 (= 1:14.4.2-1kali1) but it is not going to be installed     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).      I don't want to install these packages anymore (they are not compatible with my graphics unit). And so I do not need to install their dependencies using `apt-get -f install` (as it is suggesting). What is the way to get rid of these packages and this unmet dependency problem? (I tried `apt-get autoclean` && `apt-get autoremove`).


Logged on via ssh-key, can I reset my account password?

I am logged in on a server via sshkey (`ssh -i /home/me/.ssh/ssh-key me@server`). I got sudo rights on that server from the admin, but I can't exercise them, since I forgot my actual Unix password (or I was never told it). I am already logged on - can I reset my password via `passwd`, without knowing my old password?


How to exit login screen and start commandline while at login screen

I am at the gnome 2 login screen but I want to exit and re-enter command-line environment. I remember there was a combination hot key one has to invoke.


NTPDate runs three times at boot resulting in incorrect date

I am running Voyage Linux (a Debian-based distribution) and am having trouble getting the correct date. When I look in `/var/log/daemon.log` I see the following:               Nov 18 11:04:07 voyage ntpdate[1676]: step time server 203.97.109.165 offset 2141299826.398106 sec     Aug 20 17:06:20 voyage ntpdate[1710]: step time server 119.47.118.129 offset 2141299826.401065 sec     Jun 28 06:36:47 voyage ntpdate[1744]: step time server 203.97.109.165 offset 2141299826.460901 sec      The correct date is `Nov 18 11:04:07` but it is getting changed to the middle of June. How can I fix this?


omxplayer on different screen

I'd like to have two instnces of omxplayer and switch between them. I'm using raspian on raspberry pi. I've tried opening one instance in one screen, and then press alt+ctrl+f2 to switch to the screen two and open the other instance of omxplayer but the video of the first screen is in overlay also in the screen called with f2 (and also all other screen I have). Why? Is it possible to have 2 instances of omxplayer, or one instance with 2 layers..


printf white space character in bash script

How can the white space character be escaped in printf for the purpose of this script that currently runs in a Cygwin client? The line containing the whitespace (which by itself works from the command line as **echo $SPC** ) is               SPC=$(printf \\$(printf '%03o' 32))      In case you might wonder why, in this code I am trying to simulate an associative array such that it is not dependent on Bash 4+...would like this to be a generic example that theoretically can be run in virtually any bash environment. Here is the entire script:               #!/bin/bash          DEFAULT_INDEX=""     LAST_INDEX=0     SPC=$(printf \\$(printf '%03o' 32))          # MICROSOFT OUTLOOK VERSIONS.     OUTLOOKS=( "Cancel^Do$SPCnot$SPCtry$SPCto$SPCsend$SPCmessage$SPCvia$SPCOutlook"                "URL^Just$SPCthe$SPCmailto$SPCURL"                "Outlook$SPC2003^C:\Program$SPCFiles\Microsoft$SPCOffice\Office12"                "Outlook$SPC2007^C:\Program$SPCFiles\Microsoft$SPCOffice\Office12"                "Outlook$SPC2010^C:\Program$SPCFiles\Microsoft$SPCOffice\Office14" )          # ITERATES THROUGH ARRAY AND MAKES NUMBERED SELECTION LIST.     printOutlooksArraySelectionList() {         LIST_TITLE="MICROSOFT OUTLOOK SELECTION LIST"         echo         printf "\t\t\E[37;1;44m%-0s %s %s %s\033[0m" $LIST_TITLE         echo         echo         DEFAULT_VALUE="Outlook 2010"         index=0         for i in "${OUTLOOKS[@]}"; do             key=${i%%^*}             value=${i##*^}             if [ "$key" == "$DEFAULT_KEY" ]; then                 DEFAULT_INDEX=$index         fi                 printf "\t\E[37;44m%-3s %-13s\033[0m \E[1;34;40m%-41s\033[0m\n" \                        $index $key $value                 echo                 ((index++))         done         # SETS LAST_INDEX TO INDEX VALUE OF LAST ITEM IN ARRAY.         ((LAST_INDEX = index - 1))     }          printOutlooksArraySelectionList      Would like the output to look like the following:                           MICROSOFT OUTLOOK SELECTION LIST              0   Cancel        Do not try to send message via Outlook              1   URL           Just the mailto URL              2   Outlook 2003  C:\Program Files\Microsoft Office\Office12              3   Outlook 2007  C:\Program Files\Microsoft Office\Office12              4   Outlook 2010  C:\Program Files\Microsoft Office\Office14      To work-around, I ended up not using printf, but instead:               echo -e "\t\E[37;44m${index}\t${key}\033[0m\t\t\E[1;34;40m${value}\033[0m"      adequate for my purposes with this script.


How to dynamically host any domain w/o creating folders specifically for it?

Suppose a domain name has been pointed to my server's IP address.. soon as the domain name comes to me.. i want apache to execute...                python_script domain.tld      or perhaps..                bash_script domain.tld      if the incoming domain looks like this:               domain.tld/test      then..                bash_script domain.tld/test      should be executed. from within the bash script i can run calculations and decide what to display. perhaps things do not work this way due to security concerns but security is not my concern. just would like to test it out.


Why am I getting a syntax error with my Shell arithmetic?

I have a problem with a linux shell script (`sh`). I'm trying to write a script that calculates combinations, but I think I get overflows when trying to calculate faculties. So, I'm trying another technique. In this technique I used this:               a=`expr $var1 \* $var2 / $var3`      This is giving errors, and apperently, I can't do this:               a=`expr ($var1 \* $var2) / $var3`      because this gives errors as well. How do I do it?


Is there any option with 'ls' command that I see only the directories?

Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that? **EDIT** : I'm using Mac OS X, and `ls -d` gives me `.` even though I have directories.


How to test what shell I am using in a terminal?

How to check what shell I am using in a terminal? What is the shell I am using in MacOS?


Determine current shell name

> **Possible Duplicate:**   >  How to test what shell I am using in a terminal? How do I determine the current shell path or shell name? I only really need to distinguish `sh` and `bash`, however a portable solution would be nice.


how to detect command interpreter from within a shell script

> **Possible Duplicate:**   >  How to test what shell I am using in a terminal? For example the following script               #!/bin/bash          issue_interpreter_name      would issue:               bash


On some the shell can be read on in the command prompt, other can be seen when `help` is ran. But this are not covered by all the shells. Is there a general command to see what shell is running?


ArchBang - Missing wireless interface, or how to remap fn+F1-F1

Hello I am using ArchBang on old laptop Dell D410 (Dell D410 Technical Specification). I have troubles with wifi. My assumption (please read bellow explanation why I deducted this) is that I cannot even enable the wifi adapter with keyboard shortcuts (fn+F2). Before current installation of ArchBang release, the box was running on Windows XP with legacy version (unfortunately I do not remember the exact version) of ArchBang in dual boot. On Windows XP the wifi was running correctly. On legacy version of ArchBang there was the same problem which I have with actual version of ArchBang. When I tried to enable wifi (using fn+F2) on legacy ArchBang the message: “problem with mapping of keyboard shortcut (or something similar)” was written to dmesg (or maybe /var/log/messages sorry I do not remember exactly). The box was then reinstalled to recent version of ArchBang hoping it will solve the problem. Now when I press fn+F2 I do not get any message not in dmesg nor in /var/log/messages. However I’ve tried to issue xev and see what happens: and the result is that all shortcuts (brightness, sound control etc.) are working fine (also in real, and in the xev the codes are returned as well), except those which controls wifi (fn+F2). So my assumption is that I have problem not directly with wifi but with enabling the adapter. Wireless is enabled in BIOS, the wireless LED is not flashing. Can I issue some command from command line to enable wifi interface instead of using fn+F2 shortcut? Bellow are output of commands that I have issued:               [root@arch ~]$ uname -a     Linux arch 3.11.5-1-ARCH #1 SMP PREEMPT Mon Oct 14 08:49:01 CEST 2013 i686 GNU/Linux          [root@arch ~]# ifconfig -a     enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500             inet 192.168.1.170  netmask 255.255.255.0  broadcast 192.168.1.255             inet6 fe80::212:3fff:fe21:70fe  prefixlen 64  scopeid 0x20<link>             ether 00:12:3f:21:70:fe  txqueuelen 1000  (Ethernet)             RX packets 1369  bytes 1326271 (1.2 MiB)             RX errors 0  dropped 0  overruns 0  frame 0             TX packets 1250  bytes 160246 (156.4 KiB)             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0             device interrupt 16           lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536             inet 127.0.0.1  netmask 255.0.0.0             inet6 ::1  prefixlen 128  scopeid 0x10<host>             loop  txqueuelen 0  (Local Loopback)             RX packets 4  bytes 240 (240.0 B)             RX errors 0  dropped 0  overruns 0  frame 0             TX packets 4  bytes 240 (240.0 B)             TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0          [root@arch ~]# dmesg | grep -i wireless     [    9.064627] ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.2.2kmprq     [    9.065083] ipw2200: Detected Intel PRO/Wireless 2200BG Network Connection          [root@arch ~]# lshw -C network       *-network                          description: Ethernet interface            product: NetXtreme BCM5751 Gigabit Ethernet PCI Express            vendor: Broadcom Corporation            physical id: 0            bus info: pci@0000:01:00.0            logical name: enp1s0            version: 01            serial: 00:12:3f:21:70:fe            size: 100Mbit/s            capacity: 1Gbit/s            width: 64 bits            clock: 33MHz            capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation            configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.132 duplex=full firmware=5751-v3.29a ip=192.168.1.170 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s            resources: irq:16 memory:dfdf0000-dfdfffff       *-network UNCLAIMED            description: Network controller            product: PRO/Wireless 2200BG [Calexico2] Network Connection            vendor: Intel Corporation            physical id: 3            bus info: pci@0000:02:03.0            version: 05            width: 32 bits            clock: 33MHz            capabilities: pm cap_list            configuration: latency=64 maxlatency=24 mingnt=3            resources: memory:dfcff000-dfcfffff          [root@arch ~]# lsmod | grep -i intel     snd_intel8x0           23721  1     snd_ac97_codec         89336  1 snd_intel8x0     snd_pcm                63876  2 snd_ac97_codec,snd_intel8x0     snd_page_alloc          5974  2 snd_intel8x0,snd_pcm     snd                    44566  6 snd_ac97_codec,snd_intel8x0,snd_timer,snd_pcm     intel_agp               8688  1 i915     intel_gtt              10172  3 i915,intel_agp     agpgart                22047  3 drm,intel_agp,intel_gtt     [root@arch ~]# lsmod | grep -i ipw2200     ipw2200               128525  0     libipw                 22318  1 ipw2200     lib80211                3037  2 libipw,ipw2200     cfg80211              336964  2 libipw,ipw2200          [root@arch ~]# modinfo ipw2200     filename:       /lib/modules/3.11.5-1-ARCH/kernel/drivers/net/wireless/ipw2x00/ipw2200.ko.gz     firmware:       ipw2200-bss.fw     firmware:       ipw2200-sniffer.fw     firmware:       ipw2200-ibss.fw     license:        GPL     author:         Copyright(c) 2003-2006 Intel Corporation     version:        1.2.2kmprq     description:    Intel(R) PRO/Wireless 2200/2915 Network Driver     srcversion:     DC12C86CD79304BB5E0D6DB     alias:          pci:v00008086d00004224sv*sd*bc*sc*i*     alias:          pci:v00008086d00004223sv*sd*bc*sc*i*     alias:          pci:v00008086d00004221sv*sd*bc*sc*i*     alias:          pci:v00008086d00004220sv*sd*bc*sc*i*     alias:          pci:v00008086d0000104Fsv*sd*bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002762bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002761bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002754bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002753bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002752bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002751bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002742bc*sc*i*     alias:          pci:v00008086d00001043sv0000103Csd00002741bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002741bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002732bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002731bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002722bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002721bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002712bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002711bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002702bc*sc*i*     alias:          pci:v00008086d00001043sv00008086sd00002701bc*sc*i*     depends:        cfg80211,libipw,lib80211     intree:         Y     vermagic:       3.11.5-1-ARCH SMP preempt mod_unload modversions 686     parm:           disable:manually disable the radio (default 0 [radio on]) (int)     parm:           associate:auto associate when scanning (default off) (int)     parm:           auto_create:auto create adhoc network (default on) (int)     parm:           led:enable led control on some systems (default 1 on) (int)     parm:           debug:debug output mask (int)     parm:           channel:channel to limit associate to (default 0 [ANY]) (int)     parm:           rtap_iface:create the rtap interface (1 - create, default 0) (int)     parm:           qos_enable:enable all QoS functionalitis (int)     parm:           qos_burst_enable:enable QoS burst mode (int)     parm:           qos_no_ack_mask:mask Tx_Queue to no ack (int)     parm:           burst_duration_CCK:set CCK burst value (int)     parm:           burst_duration_OFDM:set OFDM burst value (int)     parm:           mode:network mode (0=BSS,1=IBSS,2=Monitor) (int)     parm:           bt_coexist:enable bluetooth coexistence (default off) (int)     parm:           hwcrypto:enable hardware crypto (default off) (int)     parm:           cmdlog:allocate a ring buffer for logging firmware commands (int)     parm:           roaming:enable roaming support (default on) (int)     parm:           antenna:select antenna 1=Main, 3=Aux, default 0 [both], 2=slow_diversity (choose the one with lower background noise) (int)               xev:     ###          fn+F2 (Wireless)     ##########     KeyPress event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1416790, (14,261), root:(578,476),         state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,         XLookupString gives 0 bytes:         XmbLookupString gives 0 bytes:         XFilterEvent returns: False          KeyRelease event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1416790, (14,261), root:(578,476),         state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,         XLookupString gives 0 bytes:         XFilterEvent returns: False               fn+F3 (Some battery event - No one knows because batery is old and not used)     ################################################     KeyPress event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1481398, (-28,389), root:(536,604),         state 0x0, keycode 244 (keysym 0x1008ff93, XF86Battery), same_screen YES,         XLookupString gives 0 bytes:         XmbLookupString gives 0 bytes:         XFilterEvent returns: False          KeyRelease event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1481398, (-28,389), root:(536,604),         state 0x0, keycode 244 (keysym 0x1008ff93, XF86Battery), same_screen YES,         XLookupString gives 0 bytes:         XFilterEvent returns: False          fn+F3 (Enables/Disable NumLock)     #####################     KeyPress event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1558307, (-50,327), root:(514,542),         state 0x0, keycode 77 (keysym 0xff7f, Num_Lock), same_screen YES,         XLookupString gives 0 bytes:         XmbLookupString gives 0 bytes:         XFilterEvent returns: False          KeyRelease event, serial 48, synthetic NO, window 0x1e00001,         root 0x7f, subw 0x0, time 1558370, (-50,327), root:(514,542),         state 0x10, keycode 77 (keysym 0xff7f, Num_Lock), same_screen YES,         XLookupString gives 0 bytes:         XFilterEvent returns: False      PS: I am writing here because this post was deleted from ArchLinux forums with statement that ArchLinux forums do not support ArchBang, so I registered do ArchBang forums but so far I am unable to post questions (there was troubles with spam or something like this, so now the registration takes longer)


Solaris 11 - (unix: Could not start init) Program terminated)

During a restart of a server with Solaris 11, the system halted with the following alert:               WARNING: exec(/usr/sbin/init) failed with errno 8. (unix: Could not start init) Program terminated.      The operating system keeps on reboot and never comes online. Since `init` is one of the first processes to come up we are assuming that we will never be able to log onto the server. Is there a way that we can log into the system and check what the issue is, and possible resolve it?


What does file version mean: lsattr -v

`lsattr -v` gives me the "version number" of given file(s). What does this mean? On Redhat 7.3, I could've sworn all the version numbers were 1 except those I changed with `chattr -v`. On Fedora 11, they appeared to be **random** numbers. Setting version numbers or even having multiple versions of a file could be very useful, so I want to understand how **"versioning"** works in ext3.


Will the system make sure that mdadm is sync-ed before completing a reboot?

This is a follow up to my crazy `mdadm` problem. I'm trying to figure out what might have caused `sda` to get out of sync in the first place. The only thing I can think of is that I had just run a bunch of updates and was rebooting to reload the kernel upgrade. Is it possible that both drives hadn't synced? would the system prevent a reboot if there was mdadm syncing going on? could it be made to? any other suggestions as to what might have happened? and how it could be prevented in the further. Nothing seems to be wrong with the drive.


Lock a script starting daemons

I'm run a script with cron: `*/10 * * * * flock -n /tmp/lock script` I have to make sure that only one instance of the script is running at the same time, and for that I'm using flock. The problem is that sometimes this script starts a daemon, in this case, the daemon blocks the following script executions. I know a possible solution would be unlock the file at the end of the script, but is it possible do it directly in the cron command?


Purpose of using setuid() in SUID programs

I wonder that an SUID program like `passwd` is using the `setuid()` function call. Why does it drop root privileges? Against what types of attack does this help? Buffer-overflow?


How to Format an LVM partition

I need to format a partition. But I have one LVM on my machine (VirtualBox) that is composed of **two different two partitions of two Virtual HDD** 's (sdb5 and sdc5) fdisk output ![enter image description here](http://i.stack.imgur.com/aPSIB.png) df output ![enter image description here](http://i.stack.imgur.com/TnF4b.png)


How to interpret this top command

top - 04:36:16 up 32 days,  2:33,  1 user,  load average: 251.72, 250.54, 231.19     Tasks: 785 total, 249 running, 522 sleeping,   2 stopped,  12 zombie     Cpu(s):  8.9%us, 90.5%sy,  0.4%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st     Mem:  16313868k total,  7021336k used,  9292532k free,   432196k buffers     Swap:  4194296k total,   295012k used,  3899284k free,   514320k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND     18873 nudenude  20   0 97.8m  26m 4944 R  4.0  0.2   0:09.35 php     18140 nudenude  20   0 93984  22m 4940 R  3.7  0.1   0:11.04 php     18178 nudenude  20   0 99.6m  26m 4912 R  3.7  0.2   0:11.11 php     18537 nudenude  20   0  100m  26m 4936 R  3.7  0.2   0:10.31 php     18726 nudenude  20   0 98.3m  25m 4868 R  3.7  0.2   0:09.82 php     18977 nudenude  20   0  101m  25m 4952 R  3.7  0.2   0:09.14 php     19049 nudenude  20   0 99.5m  28m 4920 R  3.7  0.2   0:08.87 php     19852 nudenude  20   0  100m  30m 4912 R  3.7  0.2   0:07.08 php     20504 nudenude  20   0 93024  18m 4880 R  3.7  0.1   0:04.86 php     20562 nudenude  20   0  100m  31m 4940 R  3.7  0.2   0:04.73 php     20681 nudenude  20   0 90912  14m 4940 R  3.7  0.1   0:04.40 php     20685 nudenude  20   0 90656  15m 4928 R  3.7  0.1   0:04.38 php      Some things are strange. Why system utilize tons of CPU for %sy? It seems to me the tasks use a lot of virtual memory even though there are still plenty of memory left. So I wonder why? Also what does 15m, 14m means in res and VIRT. Nothing is shown in man top. I checked http://unixhelp.ed.ac.uk/CGI/man-cgi?top and non of it is shown. Note: the load used to be 50%. Moreover, column VIRT is usually 0. However, once in a while it goes to this stuck mode where 90% of CPU is used by kernel. Don't know what the hell is that kernel doing. very little CPU is used by users. No wonder load is extremely high. But what? What is the kernel doing>


/etc/crontab what does "test -x" stand for

In my `/etc/crontab` file I have:               # m h dom mon dow user  command     17 *  * * * root    cd / && run-parts --report /etc/cron.hourly     25 6  * * * root  test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )     47 6  * * 7 root  test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )     52 6  1 * * root  test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )     #      I know what this does in practice but I don't understant the command lines. Man "test" doesn't help at all:               test - check file types and compare values      Any help would be greatly appreciated


Arch USB boot freezing?

I have put Arch on my USB and when it starts to boot, but I get the following error during the boot.               [73.100021] --[ end Kernel panic - not sycning: Fatal exception in interrupt


How to obtain X.509 certificate on solaris based server?

I have a Solaris based T5220 server. I'd like to install an x.509 certificate. What is the procedure to install this certificat? Does that procedure differs from one server to another? i.e. is it different for Netra 240 and T5220 servers?


ratpoison keyboard shortcut conflicts

I recently installed ratpoison as my first real foray into tiling window managers. The first problem I ran into is that the Ctrl-t keybinding used for ratpoison commands conflicts with those of other software, such as the new tab command in Mozilla Firefox (which is also Ctrl-t), or activating the menu in Debian's aptitude. In fact, it seems that even shortcuts with no apparent conflict are also affected. For instance, the Page Up/Down keys no longer scrolls, and Backspace can't bring me to the previous page in Firefox. I saw a sample .ratpoisonrc that changes the Ctrl-t key to "less" but what key is that on the keyboard?? Also, why do some other keys stop working (i.e. like Page Up Backspace, etc.)? Thanks.


What to do after a kernel panic on AIX?

There was a "kernel panic" - at least sort of.               errpt | head     IDENTIFIER TIMESTAMP  T C RESOURCE_NAME  DESCRIPTION     A6DF45AA   1205044411 I O RMCdaemon      The daemon is started.     67145A39   1205044111 U S SYSDUMP        SYSTEM DUMP     F48137AC   1205043911 U O minidump       COMPRESSED MINIMAL DUMP     0975DD6C   1205043911 P S ABEND          KERNEL ABNORMALLY TERMINATED     9DBCFDEE   1205044311 T O errdemon       ERROR LOGGING TURNED ON     E87EF1BE   1204150011 P O dumpcheck      The largest dump device is too small.     A6DF45AA   1204012511 I O RMCdaemon      The daemon is started.     67145A39   1204012311 U S SYSDUMP        SYSTEM DUMP     F48137AC   1204012111 U O minidump       COMPRESSED MINIMAL DUMP      How do I analyze the dumpfile? How can I trace what happened?


Scientific Linux install ISO hashes?

So there are:               https://www.scientificlinux.org/distributions/6x/61/      hashes, but not for the latest:               SL-61-x86_64-2011-11-09-Install-DVD.iso      Where can I find up-to-date hashes for it? [of course over HTTPS, not FTP or HTTP!!]


How to uninstall RHEL from a dual-boot system?

I had RHEL 5 and WinXP on dual-boot and then from WinXP I deleted those partitions which were allocated to RHEL. Now I am not able to start my computer. The booting process stops at grub. I tried installing XP again so that it repairs the MBR for XP but the bootable CD is not initiating the installation process. How can I recover my winXP? Edit : I will not mind formatting the drive where XP is installed (in my case it's in C drive). Problem solved : Thank you guys for your help and support. I tried the RHEL cd and then in the command mode I tried `fdisk -l` and it showed that 1 partition was being used by Linux. I deleted that and then booted through WinXP CD and followed the steps which zypher suggested and it worked.


Proftpd and Webmin - directory limits

I use proftpd and configure it via Webmin. I want to limit users access to certain directories   1. Their homes   2. /sample So I go to Files and Directories->Limit users to directories and option: Home directory works fine. The problem is with other directory. It is set just like home directory but users still can see only their home folder without `/sample`. What happened? Ubuntu 13.10


Serve content generated by a script with Apache

Suppose you have a domain that is pointed to your server's IP. As soon as it reaches your server's IP you use Apache to point it to a DocumentRoot (in a VirtualHost). But instead of pointing it to a document root, can you point it to a script? I want the script to control what is displayed on the web, not the DocumentRoot.


Customize flyspell (ispell) dictionary

I know how to add custom words to ispell, but I would like to remove certain words from the dictionary. For example, although `ass` and `asses` are correct words, I rarely type them, and would like to flag them as likely typos to `as` and `assess`. Where does ispell store its dictionary? The man page does not provide the location. Also, the man page makes it seem like there are a lot of steps to build a new dictionary, and it isn't just an ASCII file where I can remove certain words. Any advice how to build a new dictionary without a given word? **Edit** From some hints on: http://docstore.mik.ua/orelly/unix/upt/ch29_05.htm It seems like I can start with /usr/share/dict/words, remove the words I don't want, and then make a new ispell dictionary from that. However, I'm having trouble making the new dictionary. `buildhash` is the key program here, but it wants an affixfile, and I do not know how to generate that file.


Mark as executable

I'm using Elementary OS. How do I mark a .jar file as executable. I do have JDK installed, but I get an error saying it isn't marked as executable.


setxkbmap configuration

I'm using Lubuntu 13.04 without executing `lxpanel` (I killed it on purpose because I don't want to use it for the project I'm working on now). The problem is that, without `lxpanel` executing, the run prompt (`Alt`+`F2`) doesn't work, and I need a way to execute programs hitting `Alt`+`F2` without `lxpanel` being executed. Diggin' on the internet I found that you can configure your keyboard with _setxkbmap_ , for example with: *setxkbmap -option terminate:ctrl_alt_bksp*, you terminate the session. I'm trying to make something like this: `setxkbmap -option execute:alt_f2`, but it doesn't work. Does anybody know the list of available options for the `-option` attribute and if the option "execute" is available? Do you know if there's a way to do this?


Locate a directory from a relative path in ps output

When I executed the command to give the pid of my processes running, it gave me like this -               user@machineA:/$ ps -eo pid,command | grep exhibitor | grep java | grep -v grep      1615 java -jar ./exhibitor-1.2.3/lib/exhibitor-1.2.3-jar-with-dependencies.jar --fsconfigdir /opt/exhibitor/conf --hostname machineA      Now I saw this path in the above output -               ./exhibitor-1.2.3/lib/exhibitor-1.2.3-jar-with-dependencies.jar      Now I am trying to understand where this folder is `./exhibitor-1.2.3/` as I am not able to find out. Does this folder on the same ubuntu machine? Is there any way to find out that directory where it is? I am running Ubuntu 12.04


spawn external program in the background inside a loop

I am trying to stress-test (at a very basic level) a server by simulating multiple client programs with the following:               for i in {1..5} ; do echo ./client-program& ; done      but it fails with:               bash: syntax error near unexpected token `;'      How can I achieve the above and also store the `std:out` and `std::err` of each invoked instance of the "client-program" in separate files? (so that I may later `diff` them for equality).


How to make postfix create maildir?

How do you make postfix create maildir folders automatically for all users? I have these two lines in postfix main.cf, which supposed do create maildir folder after the first mail but it is not working. What am I missing?               home_mailbox = Maildir      mailbox_command =       At the moment mail looks to sent, but nowhere to be found.


libphp4 Not Found?

I'm using CentOS 6.5 and Apache 2.2.15 I've installed PHP 4.3.11 by download:               wget http://museum.php.net/php4/php-4.3.11.tar.gz     tar zxvf php-4.3.11.tar.gz     cd php-4.3.11     ./configure     make     make install      It works, i can use php via command on terminal like this: ![php-v](http://i.stack.imgur.com/SZSV9.jpg) But when i run apache, it didn't show PHP language. ![trien8](http://i.stack.imgur.com/s7eo7.jpg) I've checked, that there're no modules libphp4.so and libphp4-zts.so What wrong i did? Any help please...


how to by nscd for DNS

I am using NSCD for DNS now , but I sometimes see NSCD dying by itself . so is there any way to bypass the NSCD for DNS and what will be the disadvantage ?


join sed output

I'm looking to somehow pass the output of the following command:               $ sed -n '5p' file-A      into               $ sed '5 c\     > "string extracted from previous sed command" file-B      So basically, I want to replace line x of a file A with line x of a file B. I'm open to any other better options.


Mount Windows phone as a removable device

I know that the Zune software doesn't work with Linux of any kind, but I found a guide here that shows how to change `regedit` in Windows to use the phone as a removable device with direct access to the files. Is there a way to do this in Linux? Specifically Mint 12


How to enable dual booting option at boot screen?

I have two hard drives, 160GB and 500GB. On the 160GB I have installed RHEL 6 and on the 500GB, Windows 7. When I start, the hard drive which is set as primary is booting directly. I have set the 160GB as primary, so RHEL 6 boots. How do I set the dual booting option so that I can select which OS should boot? And by default the booting time is set as 3 seconds. How to increase the time?


How do I save changed files?

I have two folders:   * ORIGINAL/   * ORIGINAL_AND_MY_CHANGES/ My friend has a copy of ORIGINAL/. I would like to generate MY_CHANGES.tgz -- it should contain only new/changed files from ORIGINAL_AND_MY_CHANGES/ comparing to ORIGINAL/. So my friend can unpack it into his copy of ORIGINAL/ and get ORIGINAL_AND_MY_CHANGES/. How can I do this? P.S. I tried `diff` but it can't save binary data and `rsync --link-dest` -- it generates hard links which are useless in the archive. P.P.S. In my case modification time can't be used to decide which file was changed.


Why are parameters to Bash's builtin optional?

Running simply `builtin` prints nothing and returns exit code 0. This is in accordance with `help builtin`, which shows all parameters as optional. But why isn't this no-op an error? Is there a use case for this? A more useful result would be an error code or, even better, listing the currently available builtins.


Why are parameters to Bash's `command` and `type` optional?

Similar to Why are parameters to Bash's builtin optional?, these commands print nothing and return exit code 0 if no parameters are provided. But unlike `builtin`, their `help` output state that _at least one parameter is mandatory_. Is this a bug, a feature, or did I misunderstand something?               $ bash --version     GNU bash, version 4.2.10(1)-release (x86_64-pc-linux-gnu)     $ type -a command     command is a shell builtin     $ type -a type     type is a shell builtin     $ help -s command     command: command [-pVv] command [arg ...]     $ help -s type     type: type [-afptP] name [name ...]     $ command     $ echo $?     0     $ type     $ echo $?     0


Solaris zone removal and transformation

I have a Solaris server which has two zones on it. I need to remove one zone and change the remaining zone into the server's main operating system. What is the best way to do this? I was thinking of backing up a the zone that needs to be kept, reinstalling the OS on the server and then restoring the files from the backed up zone. Are there easier ways?


Multiply certain numbers in a text -file by certain constant

I want an alternative solution to this jQuery hack, tasting a bit reinventing the wheel -- look I am sure I could do this with some one-liner using basic *ix tools. Look much easier and straightforward way is to find all numbers appended with px, some `\d+px` -match and then multiply it with a constant but `\d` will fail -- match only if not prepended by a digit `[^\d]\d+px` and then do the replacement/multiplication. The simplest and the most elegant solution wins, how can you do the match- multiply-replace? _I use Vim but open to new ideas._


How can I get the most bang for my buck with the "diff" command?

I have tried using the linux `diff` command in the past without much luck or patience. I usually end up using a GUI utility like DiffMerge or Kdiff. Recently I started trying to use `diff` again to compare files on remote systems via ssh, and I have found the `-y / --side-by-side` option to be very useful, but I still feel like I'm not making this most of this utility. So I'm curious of how to achieve the following things:   1. Highlight changes or use color-coding to make the output more readable   2. Merge - Select lines with differences and effect the changes into one of the files Also, I haven't found many good examples when googling, so **if you have some linux-fu secrets for getting the most out of diff, could you please share?** I will mainly be comparing text-based configuration files but any tricks and tips would be wonderful. **For Reference** - The DiffMerge utility easily shows changes side by side with color highlighting. Icons at the top allow you to switch between views of "show all," "show differences," and "show differences with context." Would love some of this functionality at the command prompt. ![Picture.png](http://img683.imageshack.us/img683/2545/picturetv.png) ps: I should also note that one other option that I find quite useful is `\--suppress-common-lines` which I learned about on this concise and readable blog post.


Can QEMU/KVM+OCFS2 be configured to punch holes in sparse image files when files are deleted in the guest?

I'm using sparse raw image files for guest VMs and OCFS2 on the host (local- only, not clustered) for the `reflink` feature. I understand from Googling around that OCFS2 is one of the filesystems that can punch holes back into sparse files. If I understand correctly, it may be possible (and apparently can be achieved with XFS) to combine this feature with TRIM/discard support in the guest machines so that when files in the guest are deleted, space on the host is automatically reclaimed. However despite much experimentation, I haven't been able to demonstrate this working. Is this possible, and if it depends on versions of the kernel and/or QEMU, what are the minimum versions I need? Also have I missed anything with the configuration? I've:   * mounted the (ext4) guest filesystem with the `discard` option in `/etc/fstab`   * tried the current beta of Debian Wheezy for host and guest, and CentOS 6.2 for host   * tried running `fstrim` on the guest (I get `FITRIM ioctl failed: Operation not supported`—but I'm not 100% sure if this is relevent)   * tried `bus=ide` and `bus=virtio` (with CentOS 6.2 host)


migrating evolution to thunderbierd and maildir format

By default, thunderbird stores in mbox fromat, when you use `Config Editor` and search for `mail.serverDefaultStoreContractID` you find out its value: `@mozilla.org/msgstore/berkeleystore;1` If you want to change type of storing messages for fasting such as evoluton you can change it to : `@mozilla.org/msgstore/maildirstore;1` **My Question** is : I need to migraye from evolution 3.x.x to thunderbird, however i changed to maildir format my thunderbird, i googled, most of documentations mentioned to `mbox format` , Do you have any suggestion for `maildir format` for both?


Grep multiple pattern negative match

So I have a bunch of Apache logs with using the standard log format. I want to get all the log lines that did not come from a web crawler. So lets say I have a file robot_patterns with entries like               Googlebot     msnbot-media     YandexBot     bingbot      If I run the command `grep -f robot_patterns *.log` I will get all the entries by bots matching the above patterns. My actual list has ~30 entries of bots and agents that I wish to ignore. But I want to find all the entries that are **NOT from bots**. So I try `grep -v -f robot_patterns *.log` and no results are returned by grep. This is not what I expect or desire, and I am not finding an obvious way to get what I want. When using the `-v` option combined with multiple patterns in a file, grep will only return a matching line if it matches EVERY pattern.


What is the default font used in rxvt?

I have installed urxvt and I like the default font being used (white font in attached screenshot) but I can't figure out what it is. The font is not defined in Xresources or Xdefaults.![enter image description here](http://i.stack.imgur.com/7BJLt.png) I have also read that it uses one of the font in fc-list but I don't know which one is being used exactly.


How to read a .war file?

I am trying to view the content of a .war file. I first did set its permissions with `chmod 777` then when I try to accces it using:               cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/      It is giving `cd: /usr/local/standalone/deployments/Sample.war/WEB- INF/classes/: Not a directory` and I am not able to proceed further. Can someone help me in this issue?


Drop_caches doesn't drop caches?

Sometimes I see my swap file is a bit bigger then usual. I tried `sync && echo 3 > /proc/sys/vm/drop_caches` to no avail. But when I tried `swapoff -a` it takes a bit longer but the swap file is smaller after. How can I clear my swap file without using `swapoff`?


RHEL 5.5 - Need to refresh /dev/disk/by-label links

I've added a fibrechannel disk to a RHEL 5.5 server. The disk is present and shows under /dev/sdxx - But I need to give udev a kick and have it refresh the /dev/disk/by-label/LABEL links; this is where I do my mount points. I do not want to reboot the system. Any help is appreciated.


GNU parallel vs & (I mean background) vs xargs -P

I'm confused about the difference or advantage (if any) of running a set of tasks in a `.sh` script using `GNU parallel` E.g. Ole Tange's answer:               parallel ./pngout -s0 {} R{} ::: *.png      rather than say looping through them putting them in the background `&`. E.g. frostschutz's answer:               #copied from the link for illustration     for stuff in things     do     ( something       with       stuff ) &     done     wait # for all the something with stuff      In short are they just syntactically or practically different? And if practically different when should I use each?


How can I tell GRUB I want to reboot into Windows—before I reboot?

I have a dual boot Linux/windows system set up, and frequently switch from one to the other. I was thinking if I could add a menu item in one of the menus to reboot directly into windows, without stopping at the GRUB prompt. I saw this question on a forum, that's exactly what I want but it's dealing with lilo, which is not my case. I thought of a solution that would modify the default entry in the GRUB menu and then reboot, but there are some drawbacks, and I was wondering if there was a cleaner alternative. (Also, I would be interested in a solution to boot from Windows directly into Linux, but that might be harder, and does not belong here. Anyway, as long as I have it in one way, the other way could be set up as the default. **UPDATE** It seems someone asked a similar question, and if those are the suggested answers, I might as well edit `/boot/grub/grubenv` as `grub-reboot` and `grub-set-default` and `grub-editenv` do. ) Thanks in advance for any tips. **UPDATE** : This is my GRUB version: `(GRUB) 1.99-12ubuntu5-1linuxmint1` I tried running `grubonce`, the command is not found. And searching for it in the repositories gives me nothing. I'm on Linux Mint, so that might be it... Seeing `man grub-reboot`, it seems like it does what I want, as `grubonce` does. It is also available everywhere (at least it is for me, I think it is part of the grub package). I saw two related commands: `grub-editenv` and `grub-set-default`. I found out that after running `sudo grub-set-default 4`, when running `grub- editenv list` you get something similar to:               saved_entry=4      And when running `grub-reboot 4`, you get something like:               prev_saved_entry=0     saved_entry=4      Which means both do the same thing (one is temporary one is not). Surprisingly, when I tried:               sudo grub-reboot 4     sudo reboot now      It did not work, as if I hadn't done anything, it just showed me the menu as usual, and selected the first entry, saying it will boot this entry in 10s. I tried it again, I thought I might have written the wrong entry (it is zero- based, right?). That time, it just hanged at the menu screen, and I had to hard-reset the PC to be able to boot. If anyone can try this out, just to see if it's just me, I'd appreciate it. (mint has been giving me a hard time, and that would be a good occasion to change :P). Reading the code in `/boot/grub/grub.cfg`, seems like this is the way to go, but from my observations, it's just ignoring these settings...


No ports can be found using port scan

**Problem:**   I have a laptop and a server (Home-Server) with fc17. They are both using the desktop environment. I am trying to set up a VNC server on Home-Server so that I can set everything up without having to sit in front of it for everything. I have tried using the VNC server software included in the distro. and I have tried using TigerVNC Server. I can't get either one to work. When I scan the ports of my server using my laptop, it quickly stops and shown nothing. So I disabled the firewalls on both systems and forwarded all ports to the server on my router. I still cannot find any open ports on my Home-Server. I am at my wit's end. Please help me find out why I cannot find any ports on my server. Note: I can see the ports that are open on my Windows system. Note: Router has OpenVPN Server enabled.         **Scenario:**   Server: Fedora 17   Notebook: Fedora 17   Router: WNDR3700v1   Router Firmware: Gargoyle v1.5.8    **Output from "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     udp  --  anywhere             anywhere             state NEW udp dpt:openvpn     ACCEPT     udp  --  anywhere             anywhere             state NEW udp dpt:netbios-ns     ACCEPT     udp  --  anywhere             anywhere             state NEW udp dpt:netbios-dgm     ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:netbios-ssn     ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:microsoft-ds     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


Alternate screensaver settings on different X instances

On my desktop system, I run two instances of X-- one is associated with the physical screen, one is associated with a virtual screen (a la `vncserver`). I use the physical one to do things related to being physically present (e.g., mess with local equipment) and I use the virtual one for doing things that transcend and persist across my visits. I connect locally/remotely to the virtual/vncserver instance and all works great... until my default screensaver kicks in. The screensaver runs fine and independently on both instances. But when I'm connected remotely to the virtual instance and become inactive, the screensaver burns up bandwidth. I could change my default screensaver to be something less visually active, but for a variety of reasons, I like having it active on the physical instance. Given that screensaver's behavior is controlled via a file-based configuration, it seems like there should be a way to have different screensaver settings for different displays (especially since you can have different Xorg configurations). Nothing is leaping out at me though-- is it not as easy as it seems like it should be? Note: If it matters, this is on a Centos 6.x system with Gnome 2.something


qemu - two clients (tap0 & tap1) via br0 can't ping eachother but server pings ok

I've got:   * A host system running Ubuntu with KVM (functional)   * Two clients, one Ubuntu and one Windows 7, nothing fancy. I've also setup (see below) a bridge via br0 for the clients:   * br0: 192.168.2.1 (with DHCP running)   * eth0 -> br0   * tap0 -> br0   * tap1 -> br0 br0 can give IP to the clients, they get:   * Windows 7: 192.168.2.29   * Ubuntu: 192.168.2.30 ## Here's my problem:   * Windows ICMP -> br0: Works   * Ubuntu ICMP -> br0: Works   * Ubuntu ICMP -> Windows: Fails http://www.youtube.com/watch?v=5C1VvJezouI    * * * I played around with some NAT (which i'm getting the hang of via iptables) and that works like a charm! Without any issues both the clients can ping www.google.se and fetch data etc, but not between each other?! * * *    Here's the commands i'm running from the beginning to end:               tc qdisc del dev wlan0 root 2>/dev/null     tc qdisc del dev wlan0 ingress 2>/dev/null     iptables -P INPUT ACCEPT     iptables -F INPUT     iptables -P OUTPUT ACCEPT     iptables -F OUTPUT     iptables -P FORWARD DROP     iptables -F FORWARD     iptables -t nat -F PREROUTING     iptables -t nat -F OUTPUT     iptables -t nat -F POSTROUTING     iptables -t nat -F     iptables -t mangle -F     ip route flush table main     iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark          modprobe ifb numifbs=1     modprobe ip_conntrack     modprobe xt_mark     modprobe iptable_nat          echo "1" > /proc/sys/net/ipv4/ip_forward     echo "0" > /proc/sys/net/bridge/bridge-nf-call-arptables     echo "0" > /proc/sys/net/bridge/bridge-nf-call-iptables     echo "0" > /proc/sys/net/bridge/bridge-nf-call-ip6tables          ifconfig br0 192.168.2.1 netmask 255.255.255.0     route add -net 192.168.2.0 netmask 255.255.255.0 dev br0     ip route add default via 192.168.2.1 dev wlan0          kpartx -av win7.img     kpartx -av ubuntu.img          tunctl -u `whoami` -t tap0     ip link set tap0 up     brctl addif br0 tap0          tunctl -u `whoami` -t tap1     ip link set tap1 up     brctl addif br0 tap1          kvm -no-reboot -m 1300 -hda /dev/mapper/loop0p1 -boot order=c -net nic,macaddr="DE:AD:BE:EF:EC:B6" -net tap,ifname=tap0,script=/etc/qemu-dummy          kvm -no-reboot -m 1300 -hda /dev/mapper/loop1p1 -boot order=c -net nic,macaddr="DE:AD:BE:EF:EC:B7" -net tap,ifname=tap1,script=/etc/qemu-dummy      At this point, i'm trying to ping between the clients without success so i close down the systems and run:               brctl delif br0 tap0     brctl delif br0 tap1     ifconfig tap0 down     ifconfig tap1 down     tunctl -d tap0     tunctl -d tap1     kpartx -dv win7.img     kpartx -dv ubuntu.img


Command : must be run from a terminal

I have a shared hosting account, I logged using ssh. when I type for example `su` I had this output : `su: must be run from a terminal` Is this error relative to the fact that I don't have sufficient permissions or to something else ?


Changing hostname doesn't change the terminal name

I had set my hostname while installing linux as "ankit". i want to change it to "ankit.centos". I tried changing hostname in `/etc/hosts`, `/etc/sysconfig/network` and `sysctl kernel.hostname=ankit.centos`. Though the hostname is set correctly which I verified by typing `hostname` on terminal, but even after restarting the system the name on terminal is not changed it still is showing `root@ankit$`. Any clues how do change that?


mirroring a pane between two windows

Is it possible to have the same pane appear in two different windows of a single tmux session? I typically have a single horizontal split in my main window with vim in the top pane (about 80-90% of the terminal height), and a command line in the bottom pane where I run the program I'm working on. Because the bottom window is so small, I often can't see error output, and using tmux's keyboard shortcuts to scroll back is getting tiresome. I'd like to have my second window attach to the same pane so that if I need to see more of my error output, I can just quickly switch to the second window without needing to deal with scrollback. Is this possible? (I guess one fallback would be to use something like tee to write stdout to a log file and tail that in my second window. I'm hoping that's not necessary though)


Why OpenSuse (ver.13) does no install a lot of basic softwares for development. But their GUI and widget softwares are all over the place. For example, there is no `gcc` installed. there is no `make` installed. There is no `git` installed. There is no basic kernel header installed. So after fresh installation of Suse. I have to manually install a lot of things in order just to compile one of my project.


How to point to ssh folder with private keys to automatically choose one?

I would like to be able to use `ssh user@host` without the `-i identity_rsa_or_else_private_key_file` . Is there a place somewhere in `ssh` configs where I can point where are the private keys located so that the `ssh` will automatically choose one for the connection (so that I don't have to type `-i key_file`)?


How to scroll the screen using the middle click?

On Windows, most programs with large, scrollable text containers (e.g. all browsers, most word processors and IDEs) let you press the middle mouse button and then move the mouse to scroll. This scrolling is smooth and allows you to scroll very quickly using just the mouse. When I've used Linux on _laptops_ , two-finger scrolling performs roughly the same function; it's easy to scroll down a page quickly (much more quickly than one can by scrolling a mouse wheel) but the scrolling remains smooth enough to allow precise positioning. I am unsure how to achieve the same thing when running Linux on a Desktop with a mouse. As far as I can tell after a whole bunch of Googling, there are neither application-specific settings to swap to Windows-style middle mouse button behaviour, nor any system-wide settings to achieve the same effect. Just to make this concrete, let's say - if it's relevant - that I'm asking in the context of Firefox, Google Chrome, Gedit and Eclipse on a recent version of either Mint (what I use at home) or Ubuntu (what I use at work). I suspect this is a fairly distro-agnostic and application-agnostic question, though. As far as I can tell, my options for scrolling are:   * Scroll with the mousewheel - slow!   * Use the PgUp / PgDn keys - jumps a huge distance at a time so can't be used for precise positioning, and is less comfortable than using the mouse   * Drag the scroll bar at the right hand side of the screen up and down like I used to do on old Windows PCs with two-button mice. This is what I do in practice, but it's just plain less comfortable than Windows-style middle-mouse scrolling; on a huge widescreen, it takes me most of a second just to move the cursor over from the middle of the screen to the scrollbar, and most of a second to move it back again, and I have to take my eyes off the content I'm actually scrolling to do this. None of these satisfy me! This UI issue is the single thing that poisons my enjoyment of Linux on desktops and almost makes me wish I was using a laptop touchpad instead of a mouse. It irritates me enough that I've concluded that either I'm missing some basic Linux UI feature that solves this problem, or I'm just an oversensitive freak and it doesn't even bother anyone else - but I'm not sure which. So my questions are:   1. Does Windows-style middle mouse button scrolling exist anywhere in the Linux world, or is it really purely a Windows thing? In particular, do any Linux web browsers let you use Windows-style scrolling?   2. Are there any mechanisms for scrolling pages that exist in Linux but not in Windows, especially ones that perform the role I've described?   3. Any other solutions that I'm missing?


How to set Cols and Lines for a Subprocess

I have a script that runs a series of scripts numbered 001,002,003,004... etc down to 041 right now, will be more in the future - and these scripts them selves use some cursor control to print a progress bar and other status information and get the width and height of the terminal from `tput cols` and `tput lines` respectively. Without rewriting the sub-scripts, I would like to reserve _one_ line at the bottom for _overall_ status information for the outer script. I was curious if there was a way to set what tput replies for lines and cols. There must be a way because tmux achieves it. I was thinking there may be an environmental variable but the only change I can see that tmux makes when running env is setting the $TERM to screen. Any help would be greatly appreciated


How to get cron to delete files with names starting with foo and file extensions ending with bar? - done with php script

I'm sorry to post such a question but honestly, I've spent hours reading posts and still it doesn't work... Also if this should be posted else where but this felt like the right place. I have a directory /home/username/exampledomain.com/html/cache/normal/exampledomain.com ... Inside are files created by a caching system called Boost used by Drupal. The files I'm interested in have this syntax: page-name_foo.html and page- name_foo.html.gz. There is also one of each for just page-name_.html and page- name_.html.tz ... Just incase i'm not using foo correctly above, I mean foo could be anything... So I've tried a few different things now and no success... The one that feels the closet is this:               find /home/username/exampledomain.com/html/cache/normal/exampledomain.com/  -maxdepth 1 -name 'page-name_*.html*' -type f  -exec rm {} \; > /dev/null      If I run this on the command line, it works perfectly... I have a control panel that lets me just point and click for setting the timings, that usually precede the command to run... My interpretation of cron was that you could just use it to periodically run commands. I'm clearly mis-understanding things or it would just do it... :) As always, all help or pointers are very much appreciated...


sudo: ./server: command not found

I wrote a piece of software called "server" and I am trying to run it on a different linux box. The command I am typing is:               sudo ./server      I am in the directory with 'sever' in it, and it tells me that it cannot find the command. All the other questions I've seen similar to this state that sudo wasn't installed, but sudo is installed on this machine. If I try to run               ./server      it says 'Permission denied' so it knows there is a file in this directory named 'server.' I'm a windows guy normally, so if I'm missing something basic, don't laugh too hard. What am I missing?


One-way-sync a directory, but leave deleted files deleted on the destination

I want to sync a directory between two systems. To make it more interesting the syncing must only be done in one direction, i.e.:   * if a file is deleted in the source directory, it must also be deleted in the destination, if it was previously transfered   * deleted files in the destination directory must not be deleted in the source   * partially transfered files (e.g. because of network problems) must be finished on the next sync   * new files in the source directory must be transfered to the destination   * **deleted files in the destination directory must not be re-transfered** That means the source system has basically a master role, except that deleted files in the destination will not be forced back. Both Linux systems have rsync/ssh/scp available. New files in the source directory are created in such a way that one can use their mtime to detect them, e.g.:               if mtime(file) > date-of-last-sync then: it is a new file that needs to be transfered      Also, existing files are not changed in the source directory, i.e. the sync does not need to check for differences in already (completely) transfered files.


Finding out whether current alias/function/script is running inside Tmux - with a twist

**NB:** Yes, I've read How can I tell if I'm in a tmux session from a bash script? How can I find out whether I am running inside a Tmux session from my shell or shell script or shell function or alias if I used `sudo su -` in between?: ![The problem](http://i.stack.imgur.com/YOQR8.png)


How to display disk capacity via Samba?

I have a Raspberry Pi running Raspbian with a Samba 3.6.6 server. The config file:               [global]       encrypt passwords = yes       log level = 1       max log size = 1000       read only = no       security = user     [A]       browsable = yes       read only = no       create mask = 0777       directory mask = 0777       path = /mnt/a     [B]       browsable = yes       read only = no       create mask = 0777       directory mask = 0777       path = /mnt/b      Under /mnt/a and /mnt/b I have mounted 2TB NTFS drives (sda1 and sda2). Everything works but when I map those in Windows 8 it doesn't display the capacity under them. Is there a way to change this?


Is a -rw-rw-rw- file really inaccessible inside a drwxrwx--- directory?

Say I have a directory with these permissions:               drwxrwx---      Inside this directory, a file with these permissions:               -rw-rw-rw-      Is the file readable/writable by everyone or not ? If not, how secure is this access restriction? What if a random user makes a link to my file inside his home directory? Could he access the file then? Or could he access the file by guessing its inode number and using some system calls on inodes?


Invert colors of the active window

Sometimes I work in low light and I need to invert the color of specific windows to reduce my eye strain. This could be my pdf viewer to web pages for reference work. I know how to invert the entire screen:               xcalib -invert -alter      But I can't find any man pages, docs or posts how to invert _a single window only_. I did this before yet cannot find how. Bizarre! Searching the repos for other xorg tools I found xpdf, it has invert support but won't help for anything other than viewing pdf's. I don't use compositing so please don't suggest Compiz. I use Openbox WM. Thanks all. **Update** Instead of a general all-purpose tool to invert any window, I focused my search on how to invert colors for a Google Chrome tab instead. I found Color Bookmarklets, you drag them to the browser toolbar and hit them to change the page content to invert the colors (invert lightness).


How to play a G2M4 encoded .wmv file (Ubuntu)?

I was using _Ubuntu 13.04_ (end of life) - now using 13.10. I have this _.wmv_ video file. When I try to play it on _vlc_ , it shows the error below, there is no video but the audio is working properly:               No suitable decoder module:     VLC does not support the audio or video format "G2M4".     Unfortunately there is no way for you to fix this.      Do I need to install any codec? How can I play this file? * * * When I run it with _totem_ movie player, I get:               Required plugin could not be found          Videos requires to install plugins to play media files of the following     type: video/x-asf-unknown decoder      * * * > EDIT#1 This edit is after trying the answers given. 1) I installed `mplayer`. When I ran the video file it was processing something which would have taken a long time to complete. Please see the screen shot below(look at the last line). ![enter image description here](http://i.stack.imgur.com/zwmFl.png) 2) Then I installed `smplayer` (GUI). When I tried running the .wmv file, only audio came but not video (as with the case of vlc). 3) I tried upgrading my `vlc` version from the current version 2.0.8 to a higher one. I googled & tried different ways but to no avail. Then I removed it & reinstalled it.               1) sudo apt-get purge vlc          2) sudo apt-get autoremove          3) sudo apt-get install vlc      After doing all this, still the version of the `vlc` was the same 2.0.8! Why so? Is it because Ubuntu 13.04 isn't supported any more? So from Ubuntu repository, only that version can be installed? Is it that for installing latest or further versions I need to get it from website? Now also the video of the .wmv file didn't run.               4) `ubuntu-restricted-extras` are already installed.      I would like to repeat that I'm working on Ubuntu 13.04 which is not supported since last 5 months. This may be the issue. I'm preparing my laptop now for upgrading to newer versions of Ubuntu. Once I install the new OS, I will check whether the video file runs there! > EDIT#2 I've installed Ubuntu13.10 on my laptop now & removed the older unsupported one (Ubuntu 13.04). Now I tried to run the video but failed. 1) 1st I write with respect to what Seth has written. I ran `sudo apt-get install ubuntu-restricted-extras` but still the video part isn't running. 2) Now I write with respect to what Erik wrote in his answer. After installing Ubuntu13.10, I installed vlc player via `sudo apt-get install vlc`. The version of VLC was 2.0.8. (Erik, one thing to be noted. This is the same version as with ubuntu13.04.) To upgrade to 2.1.0., I ran the 3 commands (using ppa). I found the version now to be `VLC media player 2.0.10 Twoflower (revision 2.0.8+git20140326+r49189+13+8~ubuntu13.10.1)` & not 2.1.0. With this version, the .wmv file couldn't run the video part as earlier. Only audio is running as was earlier. Here the screen shot is the same as the 1st image in this Q. So, using PPA, I couldn't upgrade to 2.1.0. So, it's working the same way as with previous O.S. Only audio is functioning but not video. > EDIT#3 This edit is with reference to the answer posted by @erik I'm able to compile vlc from source (option 1 as mentioned in his answer) but still the video part couldn't be played, only the audio is working as earlier.               sudo apt-get build-dep vlc     ./configure     make     sudo make install      I didn't find any error in running the above commands. Now in this version ( 2.1.0. ) also, only audio is working and not video. So, is it that G2M4 support is there in vlc version 2.1.4 (which is in ubuntu 14.04) but not in 2.1.0.? > EDIT#4 As per illuminE's answer, I'm writing the output of the ffmpeg command below. I installed ffmpeg version 0.10 via ppa as available in one of his link. But still the command failed. I feel this version can't convert the G2M4 encoded .wmv file. I'm searching for another PPA or something else to install latest version.               ravi@ravi-Aspire-5315:~$ ffmpeg -i '/home/ravi/2014-04-12_11.39_Equity_Markets-I.wmv'  -c:v libx264 -crf 23 -c:a ac3 -q:a 100 output.mp4     ffmpeg version 0.10.12-7:0.10.12-1~saucy1 Copyright (c) 2000-2014 the FFmpeg developers       built on Apr 26 2014 10:04:40 with gcc 4.8.1       configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu --enable-shared --disable-static       avutil      configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avcodec     configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avformat    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avdevice    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       avfilter    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       swscale     configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       swresample  configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       postproc    configuration: --arch=i386 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~saucy1' --libdir=/usr/lib/i386-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/i386-linux-gnu/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc       libavutil      51. 35.100 / 51. 35.100       libavcodec     53. 61.100 / 53. 61.100       libavformat    53. 32.100 / 53. 32.100       libavdevice    53.  4.100 / 53.  4.100       libavfilter     2. 61.100 /  2. 61.100       libswscale      2.  1.100 /  2.  1.100       libswresample   0.  6.100 /  0.  6.100       libpostproc    52.  0.100 / 52.  0.100     [asf @ 0x9396ac0] max_analyze_duration 5000000 reached at 5194000     [asf @ 0x9396ac0] decoding for stream 1 failed     [asf @ 0x9396ac0] decoding for stream 2 failed     [asf @ 0x9396ac0] Could not find codec parameters (Video: g2m (G2M4 / 0x344D3247), 1920x1080, 97 kb/s)     Input #0, asf, from '/home/ravi/2014-04-12_11.39_Equity_Markets-I.wmv':       Metadata:         WMFSDKVersion   : 12.0.9600.16384         WMFSDKNeeded    : 0.0.0.0000         IsVBR           : 1         WM/ToolVersion  : 6.2.1 Build 1350         WM/ToolName     : 㙉䜴呯䵯敥楴杮         BitRateFrom the writer: 145         Audio samples   : 612         Video samples   : 393         recording time  : Sat, 12 Apr 2014 13:26:37 India Standard Time       Duration: 01:42:11.56, start: 0.000000, bitrate: 149 kb/s         Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 1 channels, s16, 48 kb/s         Stream #0:1: Data: none         Stream #0:2: Video: g2m (G2M4 / 0x344D3247), 1920x1080, 97 kb/s, 10 tbr, 1k tbn, 1k tbc     Video pixel format is unknown, stream cannot be encoded


reset for loop counter

Simple question: if I have a `for` loop (zsh) over an unreliable list, by which I mean the list contains entries that can't be predicted beforehand, then can I reset the `for` loop counter? This demonstrates what I'm asking for:               # e.g. list=(1 5 2 9)     for i in $list ; do         [[ $i = 2 ]] && i=${list[1]}     done      (This example will obviously loop forever if it worked.) I can only think of doing it like this:               for ((j=1; j<=${#list}; j++)); do         [[ ${list[$j]} = 2 ]] && j=1     done      Is there a simpler way of doing it? ("Simpler" meaning easier to follow with the eye what you're doing.)


Copy a folder and its content to all Nginx vhosts host

I am interested to know if a single command line that would allow me to recursively copy a folder to all of our NGINX Virtual Host htdocs folders: I need to copy that folder to all hosts located in vhosts :               /var/www/vhosts/*/htdocs/


Compare the similar file and not similar files display below output in awk?

I'd like to compare the following 2 files and display a comparison of the 2 files with each other. File #1:               DATE       DS      2012-08-02 1     2013-06-23 1     2013-06-27 2     2013-06-28 2     2013-06-29 779      File #2:               DATE       DE     2013-06-16 5     2013-06-17 1     2013-06-18 3     2013-06-19 1     2013-06-20 5     2013-06-21 6     2013-06-22 6     2013-06-23 6     2013-06-24 5     2013-06-25 9     2013-06-26 7     2013-06-27 22     2013-06-28 59     2013-06-29 334     2013-06-30 11      Comparison of file #1 & #2:               DATE       DS   DE      2012-08-02 -    1     2012-08-05 -    2     2013-06-16 5    -       2013-06-17 1    -       2013-06-18 3    -       2013-06-19 1    -       2013-06-20 5    -       2013-06-21 6    -     2013-06-22 6    -     2013-06-23 6    -     2013-06-24 5    -     2013-06-25 9    -     2013-06-26 7    1     2013-06-27 22   2     2013-06-28 59   2     2013-06-29 334  779     2013-06-30 11   -      Above the file1, DATE and DS means "data selected" for a particular date of how many selected. It's showing from file1 and file2 also the same, but different dates for how many "deactivated" (DE). Now I want to display from file1 & file2 using AWK. Date for $1 from both files, $2 from file1, $2 from file2. If a particular date is compared also it will display DE, DA. For example:               DATE      DE DS     2012-08-1 -   1 # Date is present in $1 from file1 but file2 is not there.                      # This is the date I want. Also I want to display a (-) for                      # DE which is not there.


Bash: How to get different color for the command line and its output?

Basically, I am trying to edit my `.bashrc` such that when I type `ls` or whatever I type on the console, it will be displayed in Green color. At the same time, all the results / output displayed by `ls` or other commands (output from a python / java script) will be displayed in a grey color. Is this possible ? What would I need to add into the `.bashrc` file ? Thanks **UPDATE:** Well. Thank you very much for the answers and comments: I saw from this this link that I just have to add the following next to the definition of `$PS1` `trap '[[ -t 1 ]] && tput sgr0' DEBUG` Then it works. I am not sure there will be any issues. But it seems to work for now.


What is the meaning of "stat" in the SFTP error message "Couldn't stat remote file"

I've seen this when using SFTP; for example when I try to remove a file that isn't on the remote server:               sftp> RM coa.dat.gz     Couldn't stat remote file: No such file or directory     Removing coa.dat.gz     Couldn't delete file: No such file or directory      Since "stat" isn't an English verb, this is a bit confusing. It is clear that this has something to do with the UNIX/Linux command `stat` or the C function `stat()`, but I welcome a more complete description.


Compiling PHP-FFMPEG Extension

cd ffmpeg-php*     phpize      ./configure --with-ffmpeg=/usr/local/cpffmpeg      make      Then I end up with the following issues on my make:               ...     ...     ...          /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: excess elements in scalar initializer     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: excess elements in scalar initializer     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:86: warning: (near initialization for âini_entriesâ)     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:92: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:130: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:143: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â token     /usr/local/cpffmpeg/include/libavformat/avio.h:266: error: old-style parameter declarations in prototyped function definition     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:163: error: expected â{â at end of input     make: *** [ffmpeg-php.lo] Error 1      * * * EDIT: I tried this:               CFLAGS=-I/usr/local/cpffmpeg/include/ ./configure --with-ffmpeg=/usr/local/cpffmpeg      and got:               make     /bin/sh /usr/src/ffmpeg-php-0.6.0/libtool --mode=compile cc  -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/cpffmpeg/include/libavcodec/ -I/usr/local/cpffmpeg/include/libavformat/ -I/usr/local/cpffmpeg/include/libavutil/ -I/usr/local/cpffmpeg/include/libswscale/ -I/usr/local/cpffmpeg/include/libavfilter/ -I/usr/local/cpffmpeg/include/libavdevice/  -DHAVE_CONFIG_H  -I/usr/local/cpffmpeg/include/ -Wall -fno-strict-aliasing   -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo     mkdir .libs      cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/cpffmpeg/include/libavcodec/ -I/usr/local/cpffmpeg/include/libavformat/ -I/usr/local/cpffmpeg/include/libavutil/ -I/usr/local/cpffmpeg/include/libswscale/ -I/usr/local/cpffmpeg/include/libavfilter/ -I/usr/local/cpffmpeg/include/libavdevice/ -DHAVE_CONFIG_H -I/usr/local/cpffmpeg/include/ -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c  -fPIC -DPIC -o .libs/ffmpeg-php.o     In file included from /usr/include/sys/stat.h:107,                      from /usr/local/include/php/main/php_streams.h:28,                      from /usr/local/include/php/main/php.h:400,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/include/bits/stat.h:91: error: field âst_atimâ has incomplete type     /usr/include/bits/stat.h:92: error: field âst_mtimâ has incomplete type     /usr/include/bits/stat.h:93: error: field âst_ctimâ has incomplete type     In file included from /usr/local/include/php/main/php_streams.h:28,                      from /usr/local/include/php/main/php.h:400,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/include/sys/stat.h:367: error: array type has incomplete element type     /usr/include/sys/stat.h:374: error: array type has incomplete element type     In file included from /usr/local/include/php/main/php.h:406,                      from /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:40:     /usr/local/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before âtime_tâ     /usr/local/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or â...â before âtime_tâ     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c: In function âzm_startup_ffmpegâ:     /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function âavcodec_initâ     make: *** [ffmpeg-php.lo] Error 1      I'm not entire sure what is wrong. Been googling for some answers but so far I've got nothing. I used http://ffmpeginstaller.com/ for the FFMPRG install. Bad idea? I know autoinstaller systems are very bad ideas. EDIT: Tried other versions, same issue.


Insert new line after non matching pattern

I have following output from script               host1:101     host1:102     host2:101     host2:102     host2:103     host4:101     host5:101     host5:102     host5:103     host5:104      etc.. I wanted to insert a new line after each host group.               host1:101     host1:102          host2:101     host2:102          host3:101     host3:102      Any AWK onliners to compare each consecute line with 1st field and insert new line before non-matching 1st field?


udev weirdness: /dev/hda1 mounted but file not present

I _think_ my question is related to udev and/or udisks, but I am really not sure at all what's going on here. To start with, my system works more or less fine. The less part is due to the fact that, after some upgrades to my Debian install, the /dev folder started acting weird, in relation to what I used to think I knew about unix drive management. To get to the point, here are two commands and their output:               $ ls /dev/h*     /dev/hidraw0  /dev/hidraw1  /dev/hidraw2  /dev/hpet          $ mount     /dev/hdb1 on / type ext3 (rw,errors=remount-ro)     tmpfs on /lib/init/rw type tmpfs (rw,nosuid,size=5242880,mode=755,size=5242880,mode=755)     ....      Now, notice that `/dev/hdb1` is mounted (it really is!) but the corresponding file doesn't appear in the `/dev` directory? How can this be? If the file doesn't exist, where is it `/dev/hdb1` listed as a link to the drive? More importantly, say I want to mount a CD. I put it in the drive, but `/dev/scd0` doesn't appear, so I can't do `mount /dev/scd0 /media/cdrom` because it gives me back a `File not found` error. However, after lots of fiddling I found two ways of doing it:               $ mount /dev/disks/by-id/ata-HL-DT-ST_DVDRAM_GSA-4160B_K3H4A7E1256     $ udisks --mount /dev/scd0 /media/cdrom      Both of the commands above work. So, my question is, how does `udisks` know how to deal with a device file that doesn't actually exist and, possibly more importantly, why does `mount` think it mounted the file system at `/dev/hdb1` while the file is not even there? Finally, in case this has to do with a recent kernel upgrade:               $ uname -srv     Linux 3.1.0-1-686-pae #1 SMP Sun Dec 11 20:40:16 UTC 2011


Does Fedora's firewall use iptables?

Fedora has a Firewall Configuration interface: ![Screenshot of the interface](http://i.stack.imgur.com/wW2Il.jpg) Does this use `iptables` underneath to enforce the rules?


Redirect the default HTTP port to an application

On my CentOS server at `mydomain.com`, I have an svn web application running on port 8880. I want to hide the port: at this moment, if anybody wants to access, they need to access through `http://thisdomain.com:8880/svn`. I want to make the application accessible at `http://thisdomain.com/`.