linux

GIT Repo -> SVN help

I am pretty sure I have tried everything, figured I would ask all the gurus on here. Background: I had an SVN repository on an old linux box. I accessed this SVN repo with git-svn. The system's hard drive crashed and the SVN repo was lost. Question: Since I have an entire backup of the SVN repository on my local machine through me usin...

Linux ping broadcast switch

When using ping on virtually every UNIX system available, pinging the broadcast address is simple: $ ping 192.168.11.255 However, when this is done on Linux, a non-standard (and continually annoying!) response occurs: $ ping 192.168.11.255 Do you want to ping broadcast? Then -b This has annoyed me to no end ever since I saw it for ...

Calling a Java program from a CGI script fails

I have a Python CGI script from which I am trying to call a Java program to perform a task. The Java program uses JExcelAPI. When I run the Python script from the browser, it fails with error messages that it can't find the class definitions for the classes from JExcelAPI. I suppose this happens because the Python CGI script is run under...

How to Awk Paragraph in complex text file?

Hi there! I have a simple log file which is very messy and I need it to be neat. The file contains log headers but are all jumbled up together therefore I need to sort the log files according to the log headers. There are no static number of lines that means that there is no fix number of lines for the each header of the text file. And I...

linux editor similar to notepad++ for packet captures

I am looking for a very specific functionality which Notepad++ has in a linux text editor: So you have a spiffy packet from tcpdump. Notepad++ allows you to easily strip away the left hex via alt+select and then delete. Some short replace spaces and line returns and you can end up with... (see below the capture) 21:43:31.790123 IP ...

need to read data from a log... tail, grep and inotifywait

I have data on one server that comes into a continuously growing log file. I need to tail that log and grep some information and then send that to another server for php to insert into a database. The computer that has the log can't be allowed access to the database. I tried this so far but my syntax on the bash command is wrong and I ca...

Making file wrap around when using fwrite

I am using an embedded system running linux.I use a ramdisk filesystem on the embedded target. My application captures real-time data and does Standard C "fwrite" to a file in this ramdisk fs.As there is limited amount of memory , I would like to set a max size for the file and cause fwrite to wrap around like a circular buffer. Is there...

How to pass AWK output into variable?

Hi there! I have a small bash script that greps/awk paragraph by using a keyword. But after adding in the extra codes : set var = "(......)" it only prints a blank line and not the paragraph. So I would like to ask if anyone knows how to properly pass the awk output into a variable for outputting? My codes: #!/bin/sh set var = "(awk...

Difference between API and ABI

I am new to linux system programming and I came across API and ABI while reading Linux System Programming. Definition of API : An API defines the interfaces by which one piece of software communicates with another at the source level. Definition of ABI : Whereas an API defines a source interface, an ABI defines the low...

Inserting pages into large mmap() files without copying data

I'm wondering if there is a way to insert blank pages near the beginning of a large (multi-GB) file that I have open with mmap(). Obviously it would be possible to add a page or two to the end, and move everything forward with memcpy(), but this would dirty every page and require an awful long time when eventually flushed to disk. I'm ...

flowchart of "cp" command in linux

Hello all, i wanna know how does cp command gets executed , i mean its flow from top most layer to kernel and back again? what is its flow , what happend when we write cp command and how it happens? please tell it in detail. @ all its reallu urgent for me to know this , so please reply ASAP thanks in advance, newbie ...

Want to know whether enough memory is free on a linux machine to deploy a new application.

I have got a linux machine whose memory snapshot when I do /proc/meminfo is : MemTotal: 16413388 kB **MemFree: 48296 kB** Buffers: 193600 kB Cached: 1986448 kB SwapCached: 874512 kB Active: 15034264 kB Inactive: 713672 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 16413388...

How to convert text file to lowercase in UNIX (but in UTF-8)

Hello, I need to convert all text to lowercase, but not using the traditional "tr" command because it does not handle UTF-8 languages properly. Is there a nice way to do that? I need some UNIX filter so I can process this in a pipe. ...

Linux / Bash using PS -f for specific PID returns in different format than PS -f, also queston about using Grep to parse this

I have a need, for a python script I'm creating, to first get just the PID of a process (based on its name) and then to get from that process, usings its PID, its time duration, which, from the printout below, would be "00:00:00" root 5686 1 0 Sep23 ? 00:00:00 process-name I am using this to get just the PID, by the p...

Keeping memory usage within available amount

I'm writing a program (a theorem prover as it happens) whose memory requirement is "as much as possible, please"; that is, it can always do better by using more memory, for practical purposes without upper bound, so what it actually needs to do is use just as much memory as is available, no more and no less. I can figure out how to prior...

How to get the modified environmental variables using c programme in Mac using bash terminal

Hi, I want to get the modified environment variables using C programme in Mac using bash terminal how to get it? if i use getenv i will get only the default system defined environment variables but i am not getting the modified one. how to get it ...

How to convert log of USBSnoopy to set of commands for usb-robot-slave?

Hello :) I used USB Snoopy to record piece of communication between my PC and USB scanner. Now I want to replay this "record" in usb-robot-slave. The problem is that I don't know how to convert log of USB Snoopy to something understandable by usb-robot :/ So I have 2 options: Find application whith do it for me (usb-robot-master is ...

Find all files matching 'name' on linux system, and search with them for 'text'

Hi, I need to find all instances of 'filename.ext' on a linux system and see which ones contain the text 'lookingfor'. Is there a set of linux command line operations that would work? ...

Change working directory in shell with a python script

I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with external program. Can it be done in a python script or I have to write bash wrapper? Example: ...

How to limit number of processes?

In my PHP web application, I am trying to limit the number of CPU/memory intensive processes that run (for example, ImageMagick's 'convert' command). I have a number of crons jobs that execute various scripts that could potentially execute too many instances of these CPU/memory intensive processes. In my attempt to limit such processes,...