linux

ubuntu: share a folder to be used by all user in group

I want to share a folder among all users of a group : dev. So that all files are regardless of the owner can be edited by anyone in the group. I have created the shared folder and set the respective permissions to the folder. When a user creates a new file in that folder it belongs to owner:dev But the permission for the files are rw-r...

Duplicate Entire MySQL Database

Is it posible to duplicate an entire MySQL database on a linux server? I know I can use export and import but the original database is >25MB so that's not ideal. Is it possible using mysqldump or by directly duplicates the database files? ...

Distinguish Java threads and OS threads?

In Production system,like Banking application running in Linux environment, How do I distinguish running Java threads and native threads? In Linux there will be Parent process for every child process, and they say 0 is the parent of all the process, will there be a Parent thread of all the forked Java threads? How do I know which Java ...

Measuring memory usage of a process on Linux

Hi I am trying to measure the memory usage of a process (a java program) on linux and have two questions related to that: I tried using the script ps_mem.py(sums values from /proc/$PID/smaps) and the peak of total memory usage was about 135MB (private and shared memory). The amount of shared memory is less than 1MB. Trying to use Valg...

can the send function block

I'm writing a chat program and for the server, when I send data can the send() function take a long time to send out the data? Here is my problem: I'm using linux 2.6 with epoll, server in single thread If send() blocks, then this means all other activity on the server will stop. Like if there is a very slow client that does not send AC...

I exported via mysqldump to a file. How do I find out the file encoding of the file ?

Given a text file in ubuntu (or debian unix in general), how do I find out the file encoding of the file ? Can I run od or hexdump on it to fingerprint its encoding ? What should I be looking out for ? ...

How do I stop Eclipse (EPIC Perl) from adding DOS CR/LF to my Perl scripts?

I use Eclipse on Windows to edit files on a remotely mounted Linux SMB share. Coupled with Samba's stubborn opposition to on-the-fly mapping, Eclipse's insistence on CR/LF creates a real headache with Perl scripts. Any workarounds? ...

Is it better to use fchmod over chmod?

Is using fchmod(int fildes, mode_t mode) a better idea than using chmod(const char * path, mode_t mode)? ...

Why am I getting a file permission error with Python

I am working with a shared hosting environment which as well as other things supports Python. I have followed the examples and deployed my cgi file and then through chmod, gave it Read and Execute Permissions to the world and then Read, Write and Execute to the owner. The code is simply this: #!/usr/bin/python # Required header that ...

Why does tomcat6 have folders in both /var/lib/ and /usr/share/?

I'm new to Linux, and I don't understand why apt-get install tomcat6 resulted in two tomcat6 folders, one in /var/lib/, the other in /usr/share/. I'm sure there is a good reason for it, but it caused me a few hours confusion with nothing working. What's the deal? ...

Ubuntu Linux Library Path

How do I determine the Ubuntu Linux Library Path? That is, how does the linker know where to got to grab the object files when linking my program? ...

ActiveX on Linux using Mono?

Hi, Is there any way for ActiveX controls to work on Linux? I'd imagine the answer is no, but just want to be sure. My company is considering a Linux port of a ASP.NET project (using Mono), but it uses ActiveX controls quite heavily, so we wonder if it's even feasible. Sorry if the question is dumb! ...

Kill random process with name

I want a way to kill a random process with a name (eg a random perl process). What would be the best way of doing this? I was thinkign of using something like this: ps aux | grep PROCESS-NAME to a file, then find a random line number, get the second column (process ID?) and kill that. For my use it doesn't actually need to be a ...

Launching mysql server: same permissions for root and for user

Hi folks, so far in my 10+ years experience with linux, all the permission problems I've ever encountered, have been successfully solved with chmod -R 777 /path/where/the/problem/has/occured (every lie has a grain of truth in it :) This time the trick doesn't work, so I'm turning to you for help. I'm compiling mysql server from scratc...

Get subprocess id in Java

I'm creating subprocesses in this way: String command = new String("some_program"); Process p = Runtime.getRuntime().exec(command); How I can get that subprocess id? P.S. I'm working on Linux. ...

PHP: How to run an external command as a specific user

I thought of suPHP but that's not what I need. It doesn't serve to my purposes to run the whole PHP script as a different user. I just need to run one single linux command line as a different user. Is it possible? ...

Return a regex match in a BASH script, instead of replacing it

I just want to match some text in a BASH script, i’v tried using sed, but I can’t seem to make it just output the match instead of replacing it with something. echo -E "TestT100String" | sed 's/[0-9]+/dontReplace/g' Which will output: TestTdontReplaceString Which isn’t what I want, I want it to output: 100 Ideally I would want it to...

Make sure int variable is 2 digits long, else add 0 in front to make it 2 digits long

How do I check a int variable ($inputNo) to see if it’s 2 or more decimal digits long? Example: inputNo="5" Should be changed to: 05 inputNo="102" Should be left alone: 102 I thought about using wc and if statements, but wc -m doesn’t seems to give the actual characters passed into wc, as wc always seems to give +1 to the charact...

Mac OSX cannot connect to Ubuntu samba

For about 3 years my mac could connect to my Ubuntu samba, and randomly it stopped working. I get an error code -36 error and it tells me that it can't connect to it. Weirdly enough, thinking I could just wipe my key chain and re-enter the user/pass (which didn't work), smbclient through the command line connects just fine. I am complete...

Linux distro/version to support when releasing a software on Linux.

We are about to release a couple of softwares with Linux support. As for Mac and Windows, the number of version to support is quite limited (xp, 2000, vista, 7 for win, 10.4-6 for Mac). But for linux it's another story. We'd like to support as many Linux as possible, but the choice is large. The questions are: Which distribution for...