linux

error /usr/local/bin/perl: Argument list too long

Hello guys ive executed this command to delete malwarm from all my websites files and keep backup from each files but after 1 mint from executing got error /usr/local/bin/perl: Argument list too long Can anyone suggest a way to avoid this error , PS ive a huge a mount of files :) perl -e "s/<script.*PaBUTyjaZYg.*script>//g;" -pi.sa...

TCP performance differences between RH Linux and Solaris in java ?

While comparing java TCP socket performance between RH Linux and Solaris, one of my test is done by using a java client sending strings and reading the replies from a java echo server. I measure the time spent to send and receive the data (i.e. the loop back round trip). The test is run 100,000 times (more occurrence are giving similar ...

How to clear directory contents in c++ on Linux (basically, i want to do 'rm -rf <directorypath>/*'

I am writing a c++ program on Linux (Ubuntu). I would like to delete the contents of a directory. It can be loose files or sub-directories. Essentially, i would like to do something equivalent to rm -rf <path-to-directory>/* Can you suggest the best way of doing this in c++ along with the required headers. Is it possible to do this...

python xinetd client disconnection handling

This may or may not being a coding issue. It may also be an xinetd deamon issue, i do not know. I have a python script which is triggered from a linux server running xinetd. Xinetd has been setup to only allow one instance as I only want one machine to be able to connect to the service, which is therefore also limited by IP. Currently...

how can i compare two text files which has multiple fields in unix

i have two text files file 1 number,name,account id,vv,sfee,dac acc,TDID 7000,john,2,0,0,1,6 7001,elen,2,0,0,1,7 7002,sami,2,0,0,1,6 7003,mike,1,0,0,2,1 8001,nike,1,2,4,1,8 8002,paul,2,0,0,2,7 file 2 number,account id,dac acc,TDID 7000,2,1,6 7001,2,1,7 7002,2,1,6 7003,1,2,1 i want to compare those two text files. if the four col...

How to wait for a certain period of time in Perl on Linux

I want a Perl script to check a certain PID every couple of minutes and then kill the process. How do I wait those couple of minutes? Thanks. ...

Grep and regex: inconsistent behaviour

Hi all, I was working on the Linux box A and I run this: grep '^\S*\s-' access_log That displayed some lines, as expected. Then I moved to the machine B and I launched exactly the same command. But this time it didn't work. I had to launch this in order to get done what I needed: grep '^[^ ]* -' access_log Before succeeding, I...

Why would a company decide to develop in Ruby on Linux and not on Windows?

Hi guys I would like to know if anyone meet a similar situation. What are the reasons for a company to decide that you must develop using Linux environment (virtual machine) and not Windows environment? Here there's no workstations with Linux at all - all computers have Windows installed. There's one production Linux server. Is it ...

Printing to a remote printer from a website

I would like to be able to print to a number of remote printers from a website. The website runs on a Linux server, and it is the application within the website that generates the print jobs. The remote printers are located at a number of broadband sites. The printers will be serial receipt printers or USB printers. There will most like...

Linux --help syntax

On a Linux system it is typical to type progname --help in order to view the help output for that program. After this you will see a description like: progname [SWITCHES] [FILES]... [ETC] My question is; is there a standardized syntax for his sort of (command-line use) documentation? In order to describe things like optional switches...

[C] fread/ftell apparently broken under Windows, works fine under Linux

So here's the problem, I'm reading a level file for my game, works fine under linux: @0 @12 200x200 version 3 @16 973 blocks @989 @993 18 zones But under windows I get the following result: @0 @212 200x200 version 3 @216 973 blocks @1200 @1204 18 zones Uh? The windows ftell stats with an offset of 200? Reading the file apparently y...

Automatically invoking gksudo like UAC

This is about me being stressed by playing the game "type a command and remember to prepend sudo or your fingers will get slapped". I am wondering if it is possible somehow to configure my Linux system or shell such that when I forget to type e.g. "sudo apt-get install emacs", instead of just telling me that I did something wrong, gksud...

M-f, M-b bindings not working on Mac X11 (through NX)

Business as usual: I've logged into my Linux machine from my MacBook Pro using NX, opened a terminal, and ... key bindings with M- (Meta-) do not work. (Talking about bash, of course.) Wait for it. I'm using a PC keyboard hooked up to my Mac (I cannot work on a cramped laptop keyboard). So I decided to investigate: used xev to capture ev...

pcm16 to pcm14 conversion using add + shift

I am studying a sound converting algorithm where an array of signed shorts is received. At a given point in the algorithm it converts the samples from 16 bits to 14 bits, and it does it like this: int16_t sample = (old_sample + 2) >> 2; For me its clear that the shifting is needed as we want to get rid of the least 2 significant bits,...

Selenium not opening virtual browser window on Linux

Hello all, I am using Selenium to conduct user interface tests with JUnit, in a Maven project. The project is located on a Linux box running IEs4Linux and Wine to allow us to run the tests in IE. Right now I'm using Xming along with Putty to view the virtual browser windows, and I am able to open an IE window with the command "ie6", an...

How do I run a script every time I save a file in Linux?

How do I run a script every time I save a file in Linux? ...

Execute C program till Ctrl+C hit in the terminal

Hi, I am writing a program that repeatedly does an operation till Ctrl+C is hit by the user in the Linux terminal. I am programming in C. Any ideas how i can implement this. I have tested my program by using "for" loops with a condition but now i want to make it run as long as Ctrl+C is hit by the user and interrupted. What I was thin...

How to figure out whether a Linux TTY is controlling a process group

So I have a tty (let's say /dev/tty5) and want to know whether it currently is a controlling tty of a process group or session, or whether it is currently unowned. POSIX has two API functions which suggest themselves here: tcgetpgrp() and tcgetsid(), both of which only work however if the caller has the tty as controlling tty -- which in...

Java Runtime.getRuntime().exec() with quotes

I am trying to run ffmpeg via the exec call on linux. However I have to use quotes in the command (ffmpeg requires it). I've been looking through the java doc for processbuilder and exec and questions on stackoverflow but I can't seem to find a solution. I need to run ffmpeg -i "rtmp://127.0.0.1/vod/sample start=1500 stop=24000" -re -...

Debugging under Linux: Is there a pseudo-tty-like circular buffer implementation?

I am developing under Linux with pretty tight constraints on disk usage. I'd like to be able to point logging to a fixed-size file. For example, if my application outputs all logs to stdout: ~/bin/myApp > /dev/debug1 and then, to see the last amount of output: cat /dev/debug1 would write out however many bytes debug1 was setup to ...