unix

Unix: Getting Export PATH to "Stick"

When setting the export path in Unix, example: export PATH=$PATH: $EC2_HOME/bin If I quit terminal and open it back up to continue working, I have to go through all the steps again, setting up the paths each time. I'm wondering how I can set the path and have it "stick" so my system knows where to find everything the next time I open ...

Howto do python command-line autocompletion but NOT only at the beginning of a string

Python, through it's readline bindings allows for great command-line autocompletion (as described in here). But, the completion only seems to work at the beginning of strings. If you want to match the middle or end of a string readline doesn't work. I would like to autocomplete strings, in a command-line python program by matching wha...

Is there a good freeware clone of the VMS editor EDT for unix or the pc?

I would like to have the same editor available on all of the platforms I frequent. Emacs and Vi are not desired solutions. ...

Does Linux provide a monotonically increasing clock to applications

Does Linux/Unix/Posix provide an API to user-space applications to access a monotonically increasing clock, with centisecond to millisecond accuracy? On Linux, /proc/uptime provides a string-based representation of a floating point number of the number of seconds the system has been up. gettimeofday(2) does not provide a monotonically ...

How does traceroute work?

It seems almost magical. What is the traceroute command doing in order to map out the entire path to some other node on the Internet? ...

What is a bus error?

What does the "bus error" message mean, and how does it differ from a segfault? ...

How do I print a field from a pipe-separated file?

I have a file with fields separated by pipe characters and I want to print only the second field. This attempt fails: $ cat file | awk -F| '{print $2}' awk: syntax error near line 1 awk: bailing out near line 1 bash: {print $2}: command not found Is there a way to do this? ...

"error: 'struct udphdr' has no member named 'source'" ... huh?

I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get: ngrep.c: In function ‘process’: ngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’ ngrep.c:545: error: ‘struct udphdr’ has no member named ‘dest’ make: *** [ngrep.o] Error 1 What does that mean, a...

How can I write a wrapper around ngrep that highlights matches?

I just learned about ngrep, a cool program that lets you easily sniff packets that match a particular string. The only problem is that it can be hard to see the match in the big blob of output. I'd like to write a wrapper script to highlight these matches -- it could use ANSI escape sequences: echo -e 'This is \e[31mRED\e[0m.' I'm mo...

How do I create a file in UNIX /tmp directory so that all users can read and write to it?

I am trying to create a file in the /tmp directory (working on a Linux UBUNTU 7.10), that has read/write/execute access for any user. So I am using the "open(fileName,O_CREAT|O_RDWR,0777)" function to create the file (from a C program) in user1 account and I would like user2 to be able to write to the specific file. However, when i chec...

How to reference man pages in CS papers?

Hi, I am busy writing my thesis (so, I guess this could count as a homework question). Now, one of the things that came up was the Unix select system call. I would like to add a reference to the appropriate man page, but all I can find that seems the slight bit official is the Single Unix Specification site that wants my money first. Sur...

Python/editline on OS X: £ sign seems to be bound to ed-prev-word

On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell. * Mac OS X 10.5.5 * Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) * European keyboard (£ is shift-3) When I type shift-3 in the Python interactive shell, I seem to invoke the previous word function, i.e. the cursor will move to the start of the l...

Setting multiple jars in java classpath

Is there a way to include all the jar files within a directory in the classpath? I'm trying java -classpath lib/*.jar:. my.package.Program and it is not able to find class files that are certainly in those jars. Do I need to add each jar file to the classpath separately? ...

grep --exclude/--include syntax (do not grep through certain files)

I'm looking for the string "foo=" (without quotes) in text files in a directory tree. It's on a common Linux machine, I have bash shell: grep -ircl "foo=" * In the directories are also many binary files which match "foo=". As these results are not relevant and slow down the search, I want grep to skip searching these files (mostly JPE...

what's a more concise way of finding text in a set of files?

I currently use the following command, but it's a little unwieldy to type. What's a shorter alternative? find . -name '*.txt' -exec grep 'sometext' '{}' \; -print Here are my requirements: limit to a file extension (I use SVN and don't want to be searching through all those .svn directories) can default to the current directory, bu...

Provide password using Shell script

I had setup my clients & server for passwordless login. Like passwordless login by copying RSA key of server to all client's /root/.ssh/id-rsa.pub. but this, I have done manually. I like to automate this process using shell script and providing password to the machines through script. If this problem is solved then I also want to use rsy...

git-upload-pack: command not found, how to fix this correctly

I have been using git to keep two copies of my project in sync, one is my local box, the other the test server. This is an issue which occurs when I log onto our remote development server using ssh; git clone [email protected]:/home/chris/myproject Initialized empty Git repository in /tmp/myproject/.git/ Password: bash: git-upload-pack...

Getting absolute path of a file

How can I convert a relative path to an absolute path in C on Unix? Is there a convenient system function for this? On Windows there is a GetFullPathName function that does the job, but I didn't find something similar on Unix... ...

What is the unix command to see how much disk space there is and how much is remaining?

I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info. ...

Is there a LINQ library for C++?

Are there any Platform agnostic (not CLI) movements to get LINQ going for C++ in some fashion? I mean a great part of server frameworks around the world run on flavors of UNIX and having access to LINQ for C++ on UNIX would probably make lots of people happy! ...