unix

procmail lockfile utility and NFS

G'day, Has anyone used the lockfile utility that ships with procmail in conjunction with NFS mounted directories? The lockfile man page states that "Lockfile is NFS-resistant and eight-bit clean." cheers, Rob ...

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned. Also, this is usually successful in highlighting the worst offender but I've often found myself resorti...

What is the best and most complete implementation of Unix system commands?

I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Windows, but I'm not sure how well that's going to work, so I wo...

What makes the Unix file system more superior to the Windows file system?

I'll admit that I don't know the inner workings of the unix operating system, so I was hoping someone could shed some light on this topic. Why is the Unix file system better than the windows file system? Would grep work just as well on Windows, or is there something fundamentally different that makes it more powerful on a Unix box? e....

Quoting command-line arguments in shell scripts

The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE. #! /bin/sh if [ "${1+set}" != "set" ] then echo "Usage; winewrap EXEC [ARGS...]" exit 1 fi EXEC="$1" shift ARGS="" for p in "$@"; do if [ -e "$p" ] then p=$(winepath -w $p) fi A...

What should we do to prepare for 2038?

I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970. #include <stdio.h> #include <time.h> #include <limits.h> void print(time_t rt) { struct tm * t = gmtime(&rt); put...

Apache - how do I build individual and/or all modules as shared modules

On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either. I had to do the following to build Apache and mod_rewrite: ./configure --prefix=/usr...

Application Control Scripts on Unix

I'm looking for some software that allows me to control a server based application, that is, there are bunch of interdependent processes that I'd like to be able to start up, shut down and monitor in a controller manner. I've come across programs like Autosys, but that's expensive and very much over the top for what I want. I've also se...

Quick ls command

I've got to get a directory listing that contains about 2 million files, but when I do an "ls" command on it nothing comes back. I've waited 3 hours. I've tried "ls | tee directory.txt", but that seems to hang forever. I assume the server is doing a lot of inode sorting. Is there any way to speed up the ls command to just get a directory...

Maximum number of inodes in a directory?

Is there a maximum number of inodes in a single directory? I have a directory of 2 million+ files and can't get an the ls command to work against that directory. So now I'm wondering if I've exceeded a limit on inodes in Linux. Is there a limit before a 2^64 numerical limit? ...

How to forcibly close a socket in TIME_WAIT?

I run a particular program on linux which sometimes crashes. If you open it quickly after that, it listens on socket 49201 instead of 49200 as it did the first time. netstat reveals that 49200 is in a TIME_WAIT state. Is there a program you can run to immediately force that socket move out of the TIME_WAIT state? ...

Why does the Bourne shell printf iterate over a %s argument?

What's going on here? printf.sh: #! /bin/sh NAME="George W. Bush" printf "Hello, %s\n" $NAME Command line session: $ ./printf.sh Hello, George Hello, W. Hello, Bush UPDATE: printf "Hello, %s\n" "$NAME" works. For why I'm not using echo, consider echo.sh: #! /bin/sh FILE="C:\tmp" echo "Filename: $FILE" Command-line: $ ./echo.s...

How do I SCP a File programatically using C

What would be the best way to do an scp or sftp copy in a unix environment using C. I'm interested in knowing the best library to use and an example if at all possible. I'm working on a solaris server with the sun tools installed. ...

What are options available to get cron's results and how to set them up ?

I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ? ...

How do I force unix (LF) line endings in Visual Studio (Express) 2008?

Is there a way to always have LF line endings in Visual Studio? I can never seem to find it! ...

Adding command recall to a Unix command line application

I'm working on a command line application for Solaris, written in Java6. I'd like to be able to scroll through a history of previous commands using the up and down arrows like many Unix tools allow (shells, VIM command mode prompt, etc). Is there any standard way of achieving this, or do I have to roll my own? ...

how does unix handle full path name with space and arguments ?

how does unix handle full path name with space and arguments ? in windows we quote the path and add the commandline arguments after, how is it in unix ? "c:\foo folder with space\foo.exe" -help update: i meant how do i recognise a path from the command line arguments. ...

Windows version of the Unix touch command

I'm looking for a Windows port of the UNIX touch command. I don't want to install an entire MKS toolkit just for the one tool. Is there a native port available somewhere or a command in Windows that does the same thing and supports features like all files in a directory by wildcard? Specifically I'm after changing mtime, ctime and atime...

prepend to a file one liner shell?

This is probably a complex solution. I am looking for a simple operator like ">>", but for prepending. I am afraid it does not exist. I'll have to do something like mv $F tmp cat header tmp > $F Anything smarter? (I am not fond of tmp files) ...

Change the "From:" address in Unix "mail"

Sending a message from the Unix command line using mail TO_ADDR results in an email from $USER@$HOSTNAME. Is there a way to change the "From:" address inserted by mail? For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedora and RHEL). [EDIT] $ mail -s Testing [email protected] ...