linux

Command or option for the xgettext, msginit, msgfmt sequence for setting the MIME type?

msgfmt “invalid multibyte sequence” error on a Polish text is corrected by manually editing the MIME Content-Type charset in the template file. Is there some command or option for the xgettext, msginit, msgfmt sequence for setting the MIME type? cat >plt.cxx <<EOF // plt.cxx #include <libintl.h> #include <locale.h> #include <iostream> i...

Allowing PHP to change file and directory ownership and permission

Hi, I'd like to build a simple web app, which manages some directory on a server. I want to give people the option to use chown and chmod. What is the safest way to give PHP this permission? The quickest thing is just running Apache and PHP as root, but that doesn't seem to be a smart idea. One other thing I thought of, was creating a...

invoking less application from GNU readline

Hi, Bit support question. Apologies for that. I have an application linked with GNU readline. The application can invoke shell commands (similar to invoking tclsh using readline wrapper). When I try to invoke the Linux less command, I get the following error: Suspend (tty output) I'm not an expert around issues of terminals. I've tried...

Is there any C++ api available to know the OS description?

I am working tools that will be used on the multiple OS and platform. This tools will provide the details of the OS on which it is running, like 32 bit or 64 bit OS, exact version of Linux,Solaris,or other OS. One way I am thinking of using the "uname -a" command to extract the OS information on the Linus/Unix based OS. Please suggest m...

Can 'find' or any other tool search for files breadth-first?

Sometimes I know a file is not so deep away, but a very dense sub-directory does not allow me to find the files I want easily. Can find (or any other tool) look for files using breadth-first search? ...

How can I tell if a file is open elsewhere in C on Linux?

How can I tell if a file is open in C? I think the more technical question would be how can I retrieve the number of references to a existing file and determine with that info if it is safe to open. The idea I am implementing is a file queue. You dump some files, my code processes the files. I don't want to start processing until the pr...

How do I divide in the Linux console?

I have to variables and I want to find the value of one divided by the other. What commands should I use to do this? ...

Adding section to ELF file

I need to be able to add an arbitrary section to an ELF file. I cannot use GPL code in this program, so BFD is out of the question. I can use libelf/gelf to read sections, but the documentation is fairly sparse for these, and I cannot figure out how to add a section. Does anybody know how to do this? I would rather not write my own ELF c...

Take a screenshot of specific application

I'm running compiz under Linux. I know compiz is able to keep all workspaces running at the same time, so if I want to take a screenshot of an application, regardless of which workspace it is on, what should I do? (Any language.) ...

Parameters to watch while running an application on linux?

Hello, I am running an application overnight on my Linux xscale device. I am looking for things,which would increase with the increase in the amount of time of running. One thing,is the memory. If you observe the memory on the xscale systems,the free memory would start decreasing,but you will see an increase in the cached memory. What ar...

Search a folder for files like "/*tmp*.log" in Python

As the title says, I'm using Linux, and the folder could contain more than one file, I want to get the one its name contain *tmp*.log (* means anything of course!). Just like what I do using Linux command line. ...

Handling Multiple Network Interfaces in Python

How can I do the following things in python: List all the IP interfaces on the current machine. Receive updates about changes in network interfaces (goes up, goes down, changes IP address). Any python package available in Ubuntu Hardy will do. ...

Sorting contents of a file in place in linux

Hi all, I have a file which has multiple columns, whitespace separated. e.g: data1 data2 data3 data4 val1 val2 val3 val4 I need to sort the file based on values in different columns, i.e sometime based on value of column 1 sometime based on value of col2 ...

Sending POST data with curl and php

Greets. So, I'm running Fedora Core 8 on an Amazon EC2. I installed httpd, php5 and libcurl, and a bunch of other stuff. Seemed to be working great, but then I realized that POST data isn't being sent by curl in my php scripts. Same request in the command line works tho. I also ran the same php scripts on my local machine (Win XP) and a...

How to directly overwrite with 'unexpand' (spaces-to-tabs conversion)?

I'm trying to use something along the lines of unexpand -t 4 *.php but am unsure how to write this command to do what I want. Weirdly, unexpand -t 4 file.php > file.php gives me an empty file. (i.e. overwriting file.php with nothing) I can specify multiple files okay, but don't know how to then overwrite each file. I could use ...

checking cluster-wide open files using gfs / clvm

Hi, I wonder if it is possible to check if a file has already been opened by another node in the same GFS cluster. For example, fuser command runs cluster-wide in TruCluster. Is it possible to query lock managers data via a command or api ? Thanks a lot B. ...

How can i install mysql workbench in fedora 11.

I download and try to install the rpm package for fedora 10, i also try compiled from source and finally ry to rebuild de rpm pakage from src.rpm package .. and nothing work.. does anyone know how can i install mysql workbench in fedora 11 ? Thanks. ...

JBoss Server Stopping

I'm having a problem with keeping a JBoss server running. Here's the command I'm using to start it: sudo /JBOSS_HOME/bin/run.sh conf -b servername.domainname.tld JBoss starts okay after about 4 minutes or so, and when I ps it, it shows up as a process. However, if I happen to log out of SSH and ps again, it's been stopped. Is there a...

get current time in seconds since the Epoch on Linux, Bash

I need something simple like date, but in seconds since 1970 instead of the current date, hours, minutes, and seconds. Date doesn't seem to offer that option. Is there an easy way? ...

Bash command (netstat etc) to show overview of packet transfer?

Let's say I have a Linux machine that is being bogged down by some network traffic. Might be someone FTPing a large file to it, a bunch of people downloading a large file, etc. What are some options I could use to determine this? I've looked over say the netstat man but I'm not sure if this would be exactly what I need. It could at leas...