unix

Logparser (Microsoft's one) or similar for Unix?

I've been looking for quite some time for an application that fills the same role as Logparser, an awesome piece of technology, but for Unix. Does anyone know of something this? (I've looked at Splunk but its an overkill, a simple command line is all I really need) Note: Being able to make SQL queries on random logs, is great and much m...

What is the difference between a symbolic link and a hard link?

Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one. ...

What's the best way to find a string/regex match in files recursively? (UNIX)

I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways. ...

How do you handle the "Too many files" problem when working in Bash?

I many times have to work with directories containing hundreds of thousands of files, doing text matching, replacing and so on. If I go the standard route of, say grep foo * I get the too many files error message, so I end up doing for i in *; do grep foo $i; done or find ../path/ | xargs -I{} grep foo "{}" But these are less th...

Does a user need admin rights to install Flash player?

Will users who do not have admin rights on their computers be able to upgrade to new Flash player version by themselves? This would be interesting to know for: Windows 98 Windows XP/2000/Vista Macs Unix/Linux ...

How to make a python, command-line program autocomplete arbitrary things NOT interpreter

I am aware of how to setup autocompletion of python objects in the python interpreter (on unix). Google shows many hits for explanations on how to do this. Unfortunately, there are so many references to that it is difficult to find what I need to do, which is slightly different. I need to know how to enable, tab/auto completion of ...

execv() and const-ness

I often use the execv() function in C++ but if some of the arguments are in C++ strings. It annoys me that I cannot do this: const char *args[4]; args[0] = "/usr/bin/whatever"; args[1] = filename.c_str(); args[2] = someparameter.c_str(); args[3] = 0; execv(args[0], args); This doesn't compile because execv() takes char *const argv[]...

When could or should I use chmod g+s on a file or directory?

In deploying to a new (Solaris 9) environment recently, one of the steps was to copy a set of files and directories to their new location and then to apply the group UID bit (using "chmod -R g+s") to all files in the directory tree giving a mode of -rwxr-s--- to everything. The result was that none of our shell scripts would execute unle...

Quick unix command to display specific lines in the middle of a file?

Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use System.out.println() as logging? In production?!) Using grep, I've found an area of the file that I'd like to take a look at, line 347340107. Other than doing something like head -<$LINENUM + 10> filename | tail -...

Spinlock Versus Semaphore!

What is the basic differences between Semaphores & Spinlock? & In what best situations or conditions, we can use these. ...

Secure access to files in a directory identified by an environment variable?

Can anyone point to some code that deals with the security of files access via a path specified (in part) by an environment variable, specifically for Unix and its variants, but Windows solutions are also of interest? This is a big long question - I'm not sure how well it fits the SO paradigm. Consider this scenario: Background: Sof...

Skip file lines until a match is found, then output the rest.

I can write a trivial script to do this but in my ongoing quest to get more familliar with unix I'd like to learn efficient methods using built in commands instead. I need to deal with very large files that have a variable number of header lines. the last header line consists of the text 'LastHeaderLine'. I wish to output everything aft...

What's a good company for simple, shell hosting?

My old shell host (StrayNet) is closing up, and I'd like to find a decent, relatively cheap Unix shell host that offers: a couple of background processes email, irc, etc., an IP address or vhost. For the record, I do have a Slicehost slice, so I'm not looking for anything to host a project. I just like having a third location to pin...

How does the 'ls' command work in Linux/Unix?

I would like to know exactly how the "Is" command works in Linux and Unix. As far as I know, ls forks & exec to the linux/unix shell and then gets the output (of the current file tree. eg./home/ankit/). I need a more detailed explanation, as I am not sure about what happens after calling fork. Could any one please explain the function...

Is there a way to change another process's environment variables?

On Unix, is there any way that one process can change another's environment variables (assuming they're all being run by the same user)? A general solution would be best, but if not, what about the specific case where one is a child of the other? Edit: How about via gdb? ...

What's the deal with all the different UIDs a process can have?

Real UID, effective UID, and some systems even have a "saved UID". What's the purpose of all these, especially the last one? ...

What's a tcpdump one-liner to dump a TCP stream that matches a given substring?

Is there a quick tcpdump one-liner to print out a TCP stream that matches a particular substring -- or, if that's not easy, how about printing out just the single TCP packet that matches the substring? ...

equivalent of time for memory checking

we can use time in a unix environment to see how long something took... shell> time some_random_command real 0m0.709s user 0m0.008s sys 0m0.012s is there an equivalent for recording memory usage of the process(es)? in particular i'm interested in peak allocation. ...

Getting The Full Result from "ps"

Hi, How do I get the full width result for the *nix command "ps"? I know we can specify something like "--cols 1000" but is there anyway I can the columns and just print out everything? ...

Can syslog Performance Be Improved?

We have an application on Linux that used the syslog mechanism. After a week spent trying to figure out why this application was running slower than expected, we discovered that if we eliminated syslog, and just wrote directly to a log file, performance improved dramatically. I understand why syslog is slower than direct file writes. ...