unix

The lines that stand out in a file, but aren't exact duplicates

I'm combing a webapp's log file for statements that stand out. Most of the lines are similar and uninteresting. I'd pass them through Unix uniq, however that filters nothing, as all the lines are slightly different: they all have a different timestamp, similar statements might print a different user ID, etc. What's a way and/or tool to...

Any good current cross-platform reference for UNIX compiler/linker options?

I have used this summary reference for years but it is beginning to show its age. If you have any you might suggest as more current I would greatly appreciate it. ...

What are the advantages of rsh versus Perl's Expect.pm?

I have a Perl Expect.pm script that does some moderately complex stuff like packaging applications, deploying the application, checking for logs, etc. on multiple remote unix hosts. My predecessor had written similar scripts using rsh. Is there a better approach between the two? Or should I use something all together different? I am...

What are the basics someone should know for Testing and Debugging on OS X or Linux?

I have a few of our senior QA engineers in town for a few days and I am in the process of prepping them for testing an app that we are porting to Linux and OS X. These guys are smart. While they are not programmers they do understand things like how to open memory dumps to find the function pointer, and write simple python to help autom...

Will Perl upgrade break older version on Linux?

I upgrade perl from perl58 to perl588 on Suse Linux.It looks that even though the Config.pm exists for the older version the newer version installation breaks the older version.While the upgrade of Perl on other OSes like HP and AIX does not disturb the older version. For eg: The perl58 and perl588 versions are present in folder say "/us...

How to execute a Unix shell script from Windows

I've got an AIX script I would like to run from a .NET application. I'm not opposed to kicking off a Windows batch file if that gives me better options. Most of what I've seen on Google relates to using a tool such as rsh or Plink, or using ssh or telnet. I don't have access to rsh or Plink (although I do have PuTTY and could probably g...

Best practices to put into a man page

Is there a best practices guideline for writing man pages? What should be included in the layout? The standard ones are: NAME SYNOPSIS DESCRIPTION EXAMPLES SEE ALSO There are others like OPTIONS, AUTHOR. As a user what would be useful to have? What isn't helpful? ...

Thompson's Trojan Compiler

I'm trying to grasp a better understanding of Thompson's Trojan Compiler (discussed in his 1984 ACM Turing Award speech "Reflections On Trusting Trust"), and so far this is how I understand it: "The original login program for Unix would accept whatever login and password the root instructed it to. It would only accept a certain password...

Warning with nftw

Hi, I'm trying to use the nftw to process some files under a directory #include <ftw.h> #include <stdio.h> int wrapper(const char * fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { printf("File %d\n", ftwbuf->base); return(0); } int main(int argc, char ** argv) { const char *name; int flags = 0; n...

Javascript Unix Epoch Time Strangeness

I have a portion of script that calculates the days remaining to an event: var currTime = Math.round(new Date().getTime() / 1000.0); var dispDate = event.find('UnixEpoch').text(); var diffDate = (dispDate - currTime) / 86400; var dateRound = Math.round(diffDate) - 30; The first line gets the current Unix Epoch time and shaves off the ...

AF_UNIX domain - why use local file names only?

When using socket in the UNIX domain, it is advisable to use path name for the directory directory mounted on the local disk. The UNIX domain only allows interprocess communication for process working on same machine. Can you please explain the above line? It is about a socket in the UNIX DOMAIN. Thanks! ...

Compress multiple files individually with Gzip

Dear all, I have several directories that look like this: dir1/ |_foo.txt |_bar.txt dir2/ |_qux.txt |_bar.txt For each of this directory I want to compress the files inside it into *.gz format then delete the uncompressed ones. So finally we hope to get something like this: dir1/ |_foo.gz |_bar.gz dir2/ |_qux.gz ...

Understanding Linux directory permissions reasoning

Hi I have 2 questions regarding linux directory permissions which I do not understand. I removed the execute flag from a folder named Documents. After that I cannot use cd on it but I still can do "ls Documents" from the parent directory and it still lists me the files in the Documents directory. I though the missing x-flag denies read...

Unable to hide a running process in terminal

I yesterday upgraded by MacPorts' apps which took apparently about 4 hours. It was irritating to see the installation process going on in one tab in terminal. Problem: to hide a running process in terminalsuch that it does not take space in my working area I found today that there a new command coproc in Bash 4: coprocess is execut...

Variables as commands in bash scripts

Hi all, I am writing a very simple bash script that tars a given directory, encrypts the output of that, and then splits the resultant file into multiple smaller files since the backup media don't support huge files. I don't have a lot of experience with bash scripting; I'm believe having issues with quoting my variables properly to al...

Programmatically remove Firefox's license agreement dialog

I am running regression tests with Selenium and am automatically launching instances of Firefox. The problem is my tests get stuck because of Firefox's license agreement dialog: . I can't click with the mouse because I am in an headless environment with a virtual graphical environment. I would like to know what Firefox's file can I e...

Removing only my files in Unix

I need to rm files from a unix directory that only belong to my id. I tried building this command, but to no avail: ls -la | grep 'myid' | awk ' { print $9 } ' | rm My result: Usage: rm [-firRe] [--] File... ...

How to use UNIX find to find (file1 OR file2)?

In the bash command line, I want to find all files that are named foo or bar. I tried this: find . -name "foo\|bar" but that doesn't work. What's the right syntax? ...

Programatically retrieving the absolute path of an OS X command-line app

On Linux, an application can easily get its absolute path by querying /proc/self/exe. On FreeBSD, it's more involved, since you have to build up a sysctl call: int mib[4]; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; char buf[1024]; size_t cb = sizeof(buf); sysctl(mib, 4, buf, &cb, NULL, 0); but it...

Remove carriage return in Unix

What is the simplest way to remove all the carriage returns /r from a file in Unix? ...