linux

Recording Memory Footprint In Linux

Is there a way we can record memory footprint? In a way that after the process has finish we still can have access to it. The typical way I check memory footprint is this: $ cat /proc/PID/status But in no way it exist after the process has finished. ...

How to check if Qt GUI application is already running (in Linux)?

I need to check if my Qt GUI application is already running in the current X session. That is, I want to forbid running several instances of it. But running several instances by different users or by the same user on another (i.e. remote) X server should be allowed. How can this be done? Thank you. ...

Batch convert unknown file encoding to UTF-8

I need to convert some files to UTF-8 because they're being outputted in an otherwise UTF-8 site and the content looks a little fugly at times. I can either do this now or I can do it as they're read in (through PHP, just using fopen, nothing fancy). Any suggestions welcome. ...

Linux API to list running processes?

I need a C/C++ API that allows me to list the running processes on a Linux system, and list the files each process has open. I do not want to end up reading the /proc/ file system directly. Can anyone think of a way to do this? ...

Invoking GCC as "cc" versus "gcc"

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). What I am wondering is if there is any difference in GCC's behavior when it is invoked one way versus the other. For example, I know that invoking GCC through the name "g++" instead of "gcc" causes GCC to behave di...

How can I monitor data on a serial port in Linux?

I'm debugging communications with a serial device, and I need to see all the data flowing both directions. It seems like this should be easy on Linux, where the serial port is represented by a file. Is there some way that I can do a sort of "bi-directional tee", where I tell my program to connect to a pipe that copies the data to a fil...

Shell Script: How to pass command line arguments to an UNIX alias?

How do I pass the command line arguments to an alias. Here is a sample: alias mkcd='mkdir $1; cd $1;' But in this case the $xx is getting translated at the alias creatin time and not at the runtime. I have, however, created a workaround using a shell function (after googling a little) like below: function mkcd(){ mkdir $1; cd...

Can I setup eclipse to show code changes (I have svn)

I have used netbeans before with svn, and I liked how it showed me what I had changed since last commit, using the coloring in the left margin. Can Elipse do the same? I have installed svnclipse.... ...

What is the appropriate way to run higher privilege commands via over HTTP

I have a web project for which I need to run a command when a specific URL is requested, but that command requires root privileges. The project is served with a Python process (Django), of course running it with root privileges is not an option. The command's parameters are hardcoded making it impossible to inject anything and it's a r...

What is the ideal & fastest way to communicate between kernel and user space?

I know that information exchange can happen via following interfaces between kernel and user space programs system calls ioctls /proc & /sys netlink I want to find out If I have missed any other interface? Which one of them is the fastest way to exchange large amounts of data? (and if there is any document/mail/explanation supporti...

nm reports symbol is defined but ldd reports symbol is undefined

I'm having a linking problem. I need to link against a shared library libfoo.so that depends on a function read which I would like to define myself in the file read.c. I compile and link everything together but at runtime I get the error /home/bar/src/libfoo.so: undefined symbol: sread. nm reports the symbol is defined $nm baz | g...

how to investigate ports opened by a certain process in linux?

Suppose the PID of the process is already known ...

Ubuntu Startup Script for Varnish

I am wondering if anyone has a working startup script (/etc/init.d/varnish) for Varnishd that works on Ubuntu Hardy. It should set a pid file so it can be monitored. I have been looking all over Google but have yet to find something that works without hacking which I don't have time to do for a few days. ...

Could someone give me an example of a .htaccess that would remove www?

Could someone give me an example of a .htaccess that would remove www from http:// and https:// ? I want to remove the www from BOTH ssl & www:80 ...

How to sort a bunch of files alphabetically, recursively

On Ubuntu, I have a bunch of files in a tree all called 'output.txt'. For each file I want to sort the lines alphabetically with 'sort'. I considered find . -name output.txt -exec sort{} \; but this outputs the sorted lines to the console rather than updating the original files which is what I want. ...

Linux/Mac OS X equivalents for Windows Communication Foundation

--edit-- What application development frameworks/component models for Linux and Mac OS X are analogous to Windows Communication Foundation & COM, which provide high level IPC mechanisms for manipulating/communicating with software applications? By high level communication model I mean RPC, publish/subscribe, etc. I'm writing software ...

How to resolve Oracle RemoteOperationException: Error reading error from command

I have recently been receiving the following error whenever I am asked to supply the host username and password in Oracle DataGuard's Enterprise Manager (EM) tool: RemoteOperationException: Error reading error from command. Any configuration or management that needs to be performed and requires the host credentials is throwing this error...

.htaccess not working (mod_rewrite)

I have not having any luck getting my .htaccess with mod_rewrite working. Basically all I am trying to do is remove 'www' from "http://www.example.com" and "https://www.example.com". If there is anything I am missing (conf files, etc let me know I willl update this) Here is my .htaccess file (located @ /var/www/site/trunk/html/) Opti...

How can I use rsync to backup files changed within a recent period?

Is it possible to specify a time range so that rsync only operates on recently changed files. I'm writing a script to backup recently added files over SSH and rsync seems like an efficient solution. My problem is that my source directories contain a huge backlog of older files which I have no interest in backing up. The only solution I...

Overcoming a badly behaving Linux process?

I have a badly behaving process (launched via a user command) which keeps dying at erratic intervals, and I need it to stay alive till I manually kill it. Here is my straight, but probably stupid solution: #!/bin/bash if [ -z $1 ] then echo "Usage: /s98ize.sh <process name>" exit fi #start of the 'polling' loop while [ 1 ] do pgre...