unix

Why would a TAR file be smaller than it’s contents?

I have a directory I’m archiving: $ du -sh oldcode 1400848 $ tar cf oldcode.tar oldcode So the directory is 1.4gb. The file is significantly smaller, though: $ ls -l oldcode.tar -rw-r--r-- 1 ieure ieure 940339200 2002-01-30 10:33 oldcode.tar Only 897mb. It’s not compressed in any way: $ file oldcode.tar oldcode.tar: POSIX tar arch...

Unix commands from C#

Is there an implementation of a Unix shell and commands as a .Net assembly. This could be a wrapper around cygwin, or a standalone built from public domain source. The kind of commands I'd really like to be able to use are wc, tar, cpio, ps, kill, cat, at ... how cool would it be to do this (Pseudo code) usng cygwin ..... Shell mySh...

What are some good resources for learning network programming?

I recently started attending two classes in school that focus on networking, one regarding distributed systems and another regarding computer networks in general. After completing the first labs for the two classes, I now have a pretty good understand of network protocol and socket concepts with both C and Java. Now I'm trying to move b...

Does anyone offer free email/ssh provisions?

I wish to learn the UNIX SHELL can someone provide me with services such as these? SSH/POP etc? ...

unix shell nightmares

What are the worst/best unix shell nightmares? My favourites are: rm -rf / tmp/foo (deletes everything if you are root; typo :-( ) rm -rf .* (deletes everything if you are root; not just all hidden files) Files in * that are used as parameters, e.g. after touch -- -rf, rm * eventually evaluates to rm -rf foo bar cat foo | sed 's/foo/ba...

Monitor Directory for Changes

Much like a similar SO question, I am trying to monitor a directory on a Linux box for the addition of new files and would like to immediately process these new files when they arrive. Any ideas on the best way to implement this? ...

Meaning of Path Structure on Unix

Hello, Does anybody have a reference to what the various path names mean on different flavors of Unix? Please include Solaris, RHEL, and SLES in the list if possible. e.g. From what I have gathered /lib is standard libraries for the distribution, which never change (is this correct? or do they get new versions from time to time?), /...

How can I create a loop between two TTYs?

Every Hello has a response. Second TTY will send a hello to the sender TTY and vice versa: echo 'echo hello > /dev/pts/1' > /dev/pts/0 The 1st receiver should send "hello" to the original sender, but it does not. What is wrong? [Clarification] I have two shells running. /dev/pts/1 is the initial sender. ...

Why does exec-ing gtar hang my Perl program?

When using gtar to add extra files to an existing archive, the loop terminates prematurely or hangs. It also terminates after creating the initial tar.gz file. However, if I remove the gtar calls from the loop and put print statements in their place instead, the loop executes as expected. Does anyone know why this is? Below is the code ...

Sender and receiver to transfer files over ssh on request?

I created a program that iterates over a bunch of files and invokes for some of them: scp <file> user@host:<remotefile> However, in my case, there may be thousands of small files that need to transferred, and scp is opening a new ssh connection for each of them, which has quite some overhead. I was wondering if there is no solution w...

Add last n lines of files to tar/zip

I need to regularly send a collection of log files that can grow quite large, so I would like to only send the last n lines of the each of the files. for example: /usr/local/data_store1/file.txt (500 lines) /usr/local/data_store2/file.txt (800 lines) Given a file with a list of needed files named files.txt, I would like to create an...

Unix vs. Windows rendering of characters

I have a text file that display differently when opening it in FreeBSD vs. Windows. On FreeBSD: An·lisis e InvestigaciÛn On Windows: Análisis e Investigación The windows representation is obviously right. Any ideas on how to get that result in bsd? ...

View CPU usage of individual processors in UNIX

I am trying to diagnose a problem on a server box that I believe is related to CPU usage. However, when I log in to the box and run 'top' I see a %CPU of 160 or higher. This is because this is a multi-processor box. How do I see the CPU usage of the individual processors? How can I do this in real time? Thanks! ...

Cross-Compiling JRE/JDK

Have somebody experiences with cross-compiling the sun-java5 source package (debian) from i386/i586 to the hppa architecture? Or know a source for java for PA-RISC? I've found only the Package for HP-UX. Kaffe/gcj are not able to run my third-party java application ...

How to run Unix shell script from java code?

It is quite simple to run a Unix command from java. Runtime.getRuntime().exec(myCommand); But is it possible to run a Unix shell script from java code? If yes, would it be a good practice to run a shell script from within java code? ...

How do I daemonize an arbitrary script in unix?

I'd like a daemonizer that can turn an arbitrary, generic script or command into a daemon. There are two common cases I'd like to deal with: I have a script that should run forever. If it ever dies (or on reboot), restart it. Don't let there ever be two copies running at once (detect if a copy is already running and don't launch it ...

Should I use c++ or script for a daemon process?

I need to implement a daemon that needs to extract data from a database, load the data to memory, and according to this data perform actions like sending emails or write/update files. These actions need to be performed every 30 minutes. I really don't know what to decide. Compile a c++ program that will do the task or use scripts and mi...

Possible to abort shutdown on Linux?

I'm familiar with and use shutdown in Linux, and typically just do > shutdown -h now But is there a way to stop shutdown from happening, say if I aim to shutdown 10 minutes from now and then in 5 minutes time I discover I really don't want to shut down? ...

What should Linux/Unix 'make install' consist of?

I've written a C++ program (command line, portable code) and I'm trying to release a Linux version at the same time as the Windows version. I've written a makefile as follows: ayane: *.cpp *.h g++ -Wno-write-strings -oayane *.cpp Straightforward enough so far; but I'm given to understand it's customary to have a second step, make...

How do you set a directory to have persistent group permissions?

We have two users: user1 user2 They both belong to the group 'admin'. We have a directory that has been set to 775. The directory's group has been changed to 'admin'. Each user has full access to write into that directory, though when a user writes a new file to the directory, the group permissions of the folder are not persisted to...