unix

mounting devices not allow binaries

what command will mount device /device/sdal to the mount point /mnt/usb with a filesystem type of ext 3 and not allow binaries executed from the device ...

CURL fails to send post data over 1024 bytes via command line

I am trying to post a large XML file to a web address by using curl in a shell script. I am posting the data using the '-F' option in curl. Whenever I post a file larger than 1024 bytes, the file gets cut off and only sends the first 1024. I've tried changing the "Expect:" header as suggested in another solution for PHP Curl, but it d...

How to convert errno in UNIX to corresponding string?

Is there any function in UNIX to the convert errno to its corresponding string for e.g. EIDRM to "EIDRM". Its very annoying to debug to check for errors with these integer errnos. ...

Shell script for getting the sequence and changing it?

I have a command like echo "abcd0001gfh.DAT" | sed 's/^[^0-9]*\(....\).*$/\1/' | awk '{ print "00"$0 }' This will give me an output of 000001. But I want to run this in a loop where I receive the file name from 0001-9999 and again it becomes 0001. So my output should like below abcd0001gfh.DAT 000001 abcd0002gfh.DAT 000002 . . . a...

rename a file in c

I was just wondering how could i rename a file on unix platform using a c program without using the standard rename function.any ideas? rename a file in c ...

Single unix command to correctly transfer a large file?

I am trying to transfer a large (~3GB) file between two unix machines. I can use scp or rsync, but sometimes the transfer is corrupted. (I have to check manually.) I can split the file into pieces and transfer them and then checksum and then recombine, but this is tedious. Is there a single command to correctly transfer a large file be...

Can a program figure out its Oracle resource usage?

My boss would like to find a way for a running executable to ask Oracle, the size of the resources that the program is used. The purpose behind this is so that we can add to the user documentation/capacity planning documentation information on the size of the resources needed for each program. My Google-Fu is weak today, and I really...

Unpacking a directory into its parent directory.

I've got a directory (wordpress) in a folder (the main html directory of my website) and I'd like to "unpack" it into the main html directory. That is to say, I'd like to remove the wordpress directory and have all its subdirectories be under /html/ instead of /html/wordpress/. How do I do this? ...

Which Java Service or Daemon framework would you recommend?

I have encountered many different ways to turn a Java program into a Windows Service or a *nix daemon, such as Java Service Wrapper, Apache Commons Daemon, and so on. Barring licensing concerns (such as JSW's GPL or pay dual-license), and more advanced features, which one would you recommend? All I intend to do is convert a simple Java p...

What exactly does "ar" utility do?

I don't really understand what ar utility does on Unix systems. I know it can be somehow used for creating c libraries, but all that man page tells me is that it is used to make archives from files, which sounds similar to, for example, tar.... ...

How to allow a user to edit data in a separate app from the terminal?

I am writing a terminal-based application, but I want the user to be able to edit certain text data in a separate editor. For example, if the user chooses to edit the list of current usernames, the list should open as a text file in the user's favorite editor (vim, gedit, etc.). This will probably be an environment variable such as $MY...

Respond to shell prompts from Ant SSH task (SSHEXEC)

I'm using the SSHEXEC ant task to run an SSH script against a remote linux box. This has worked fine until I try and call a ksh script which prompts the user for input. The script changes the current user (like su). It prompts the user for a change_request_id, and a change_request_reason. So using this command normally in a shell wou...

How to find the library type (.so or .a) in C++/UNIX

Given a C++/UNIX library file (without extension), i need to determine the type of library whether it is a dynamic library (.so file) or a static library (.a file) based on its content (say grepping the content against a keyword) How do i do it in UNIX command line ? ...

Initial Heap size alloted to a C++ program on UNIX

What is the initial heap size alloted typically to a C++ program running on UNIX based OS ? How is it decided by the g++ compiler if at all it has a role to play in this regard ? ...

Strip metadata from files in Snow Leopard

I found the command "mdls" which will show the metadata but I can't see how to delete it. I want to get rid of the comments "kMDItemFinderComment", "kMDItemWhereFroms" from my files. Is there a way to do this? ...

Optimized code on Unix?

What is the best and easiest method to debug optimized code on Unix which is written in C? Sometimes we also don't have the code for building an unoptimized library. ...

Can ImageMagick return the image size?

I'm using ImageMagick from the command line to resize images: convert -size 320x240 image.jpg However, I don't know what size ImageMagick is resizing the image too. Since this is a proportionaly image scale, it's very possible that new image is 100x240 ... or 320x90 in size (not 320x240). Can I call the 'convert' command to resize t...

Grab SQL being executed in a shell script

Given a shell script containing a bunch of SQL statements, is there an option to redirect just the SQL statements to stdout/file? The structure of the script is something like this: ... for i in *list* do isql *credentials etc* <<EOF > a.out select *about 100 cols* from $i + "_TAB" go EOF done ... Query has been...

MacPorts/Unix/bash question

I'm new to all things shell/binary, and was installing git (I understand scm is a good thing from being on SO). My internet hiccuped partway through, however, and the installation stalled. It interrupted a tar.gz download, and I don't know quite how to resume where it left off. Here's the output: computer:~ Alex$ sudo port install git...

Appending Text To the Existing First Line with Sed

I have a data that looks like this (FASTA format). Note that in comes with block of 2 ">" header and the sequence. >SRR018006 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGN >SRR018006 ACCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC What I want to do is to append a text (e.g. "foo" in the > header) yielding: >SRR018006-foo NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...