unix

getsockopt() returns EINPROGRESS in non blocking connect()+select() flow [closed]

Update: My BAD. The error I am getting is ECONNREFUSED and not EINPROGRESS. After I had checked the %error% variable and found that it is greater than 0, I printfed errno instead of %error%. Of course errno is EINPROGRESS because it value didn't change since the call to connect(). Question answered. Thanks folks. I am using the the...

Concept of "Performance Counters" in Linux/Unix

Windows has a Performance Counters infrastructure. The OS provides some common counters, and I can go add my own. What is the corresponding concept in Linux/Unix? ...

UNIX wrapper in PHP

For a simple web application, I'd like to be able to take advantage of several UNIX features that are stable, have a long history, and are well proven in production, rather than having to write my own code. Take users, for example. Rather than having an entire user, group, permission infrastructure in my webapp, I'd like to be able to si...

How can I traverse a directory tree using a bash or Perl script?

I am interested into getting into bash scripting and would like to know how you can traverse a unix directory and log the path to the file you are currently looking at if it matches a regex criteria. It would go like this: Traverse a large unix directory path file/folder structure. If the current file's contents contained a string tha...

Most powerful examples of Unix commands or scripts every programmer should know

There are many things that all programmers should know, but I am particularly interested in the Unix/Linux commands that we should all know. For accomplishing tasks that we may come up against at some point such as refactoring, reporting, network updates etc. The reason I am curious is because having previously worked as a software test...

comparing files

hi guys i have two pipe delimited files,first file contains 1000 records and second file contains 10 records and records which are present in second file exists first file. Now need a file which which will give me 990 records by excluding 10 records which occur in both files, i know how to this using SQL .But how can we acheive this in...

Setting up Mercurial for members of a unix group

I have a Mercurial repository set up on a Linux server, and some (but not all) users have permission to push to it. They connect to the repository over ssh. These users are members of a unix group together. Below is the script I'm using to alter a repository to allow it to receive pushes from them. Can this be improved? Are there unnec...

Upload file button for remote files

Hi all, Here's the scenario. I have a simple browse button. Right now, it opens up the folder hierarchy on my local computer. (PC). However, I want to pick a file from a remote unix server which I have access to. Is there a way to display the file hierarchy of the remote unix server WITHOUT having to mount the drive? Are there...

how do I zip a whole folder tree in unix, but only certain files?

Hi everyone, I've been stuck on a little unix command line problem. I have a website folder (4gb) I need to grab a copy of, but just the .php, .html, .js and .css files (which is only a couple hundred kb). I'm thinking ideally, there is a way to zip or tar a whole folder but only grabbing certain file extensions, while retaining subf...

How can I monitor outgoing email from Unix and Sendmail?

I am running a FreeBSD server and I have been sent a warning that spam has been sent from my server. I do not have it set as an open relay and I have customized the sendmail configuration. I'd like to know who is sending what email along with their username, email subject line as well as a summary of how much mail they have been sending....

Unix scripting, trying to hosts, getting "013 not found: 3(NXDOMAIN)"

Hi people, I have a text file, a.txt. Contents are: $ cat a.txt microsoft.com google.com ibm.com I'm trying to run a host command on each line to get the IP address. Here is my script: #!/bin/sh for i in `cat a.txt` do echo $i host $i done When i run it I get this: $ ./a.sh microsoft.com Host microsoft.com\013 not found: 3(NXDOMA...

Can a local glassfish on windows be configured to work with a remote db2 on UNIX?

Hello I am trying to make db2 work in glassfish with no luck at all. I've read the documentation, but no matter what I do I end up stuck with an error when I do a ping. I put the jar files for the db2 driver and connectivity in the classpath prefix, added them to the lib directory of the domain and no go. What am I doing wrong? Thank yo...

Shell scripting for godaddy coupon codes - how does this script work?

On a coupon site someone posted a shell script for finding Godaddy discount codes. 1 - Could someone explain how this script works? Specifically, I'm confused about the syntax: links url -dump | grep AI 2 - Does shell scripting allow you to spider a site just as perl/python/ruby would? 3 - Is the most efficient way to accomplish...

Why use SysV or POSIX shared memory vs mmap()?

Needing to use IPC to pass large-ish amounts of data (200kb+) from a child process to a parent on OS X 10.4 and above, I read up on shared memory on Unix, specifically System V and POSIX shared memory mechanisms. Then I realized that mmap() can be used with the MAP_ANON and MAP_SHARED flags to do a similar thing (or just with the MAP_SH...

extract words from a file

I'm trying to create a dictionary of words from a collection of files. Is there a simple way to print all the words in a file, one per line? ...

How to find the return value of last executed command in UNIX?

How to find the return value of last executed command in UNIX? ...

How to compare 2 symbolic links in unix (Linux)?

What would be an elegant way of comparing 2 symbolic links in Unix? Assume I have entered the following commands: ln -s /usr/share/g s1 ln -s /usr/share/g s2 ln -s ../share/g /usr/lib/s3 ln -s /usr/share/h s4 then I would like to have a command that says that s1 and s2 are equal (whether /usr/share/g actually exists is not relevant),...

using unix domain socket and sharing fd's

Hello All, Not been able to figure out why recvmsg() blocks when i try this test app on ubuntu. http://web.mit.edu/kolya/misc/break-chroot.c thanks ...

To show directory structure as a tree similarly as Pstree

I would like to see my current directory structure as a tree such that no directories below the current directory is shown, similarly as Pstree: I did not find an option for that from ls in OS X Leopard. How can you make a tree of your current directory structure in terminal? ...

What is the (theoretical) best way to sterilize inputs?

I know of taking out slashes, changing HTML to ", lowercasing everything. I just don't know what is the best or foolproof way of doing this. Any help? ...