unix

In Unix, how do I find out which executables or processes are using my shared libraries?

How do I find out which executables or processes are using my shared library objects in a Unix environment, specifically the AIX environment. Is there any command for it? ...

can i know abt the exit status of the scp command in unix

while doing the programing in perl with scp command i am stucked with facing the exit status of scp command if you tell which exit value(other then 0-success,1-error) is for what my life will be simple ...

exit status of the ping command

while doing with the perl script I am stucked with the exit status of the ping command ...

Windows equivilent to UNIX pwd

How do I find the local path on windows in a command prompt? ...

Is SSH logging capabilities equivalent to su logging for private/public key authentication?

Here at work, we have a non-root shared login account on UNIX that is used to admin a particular application. The policy is to not allow direct logins to the shared account; you must login as yourself and use the "su" command to change over to the shared account. This is for logging/security purposes. I've started using SSH public/priv...

unix command line execute with . (dot) vs. without

At a unix command line, what's the difference between executing a program by simply typing it's name, vs. executing a program by typing a . (dot) followed by the program name? e.g.: runme vs. . runme ...

Why is php's fsockopen returning (Resource temporarily unavailable)?

I have a very simple server php code like this function listenForClients() { $this->serviceConnection = socket_create(AF_UNIX, SOCK_STREAM, 0); socket_bind($this->serviceConnection, "\tmp\mysock", 0); socket_listen($this->serviceConnection, 10000000); while($clientSocket = socket_accept($this->serviceConnection...

Is a secret token generated with /dev/urandom a good way to protect a daemon?

I have a daemon process which spawns subprocesses. Sometimes these subprocesses need to communicate back to the daemon. I want to ensure that only these subprocesses are authorized to communicate with the daemon. I want to implement this as follows: During startup, the daemon generates a random 128-byte secret token by reading /dev/ur...

Add up a column of numbers at the Unix shell

Given a list of files in files.txt, I can get a list of their sizes like this: cat files.txt | xargs ls -l | cut -c 23-30 which produces something like this: 151552 319488 1536000 225280 How can I get the total of all those numbers? ...

about fork and execve system call

It is said that fork system call creates a clone of the calling process,and then(usually) the child process issues execve system call to change its image and running a new process.Why this two-step? Btw,what does execve stands for? ...

FIFO (named pipe) messaging obstacles

I plan to use Unix named pipes (mkfifo) for simple multi-process messaging. A message would be just a single line of text. Would you discourage me from that? What obstacles should I expect? I have noticed these limitations: A sender cannot continue until the message is received. A receiver is blocked until there are some data. Nonblo...

How do you get a / into a filename?

How do you get a / into a filename (i.e., a / that doesn't separate components of the path)? ...

Opening a file on unix using c++

I am trying to open a file in c++ and the server the progam in running on is based on tux. string filename = "../dir/input.txt"; works but string filename = "~jal/dir1/dir/input.txt"; fails Is there any way to open a file in c++ when the filename provided is in the second format? ...

how to find the location of the executable in C

Is there a way in C/C++ to find the location (full path) of the current executed program (the problem with argv[0] is that it does not give the full path). Thanks. ...

Is there a way to use Cygwin to run shell scripts and use proper path seperators for java commands

I'm trying to use Cygwin to test startup scripts for a Java application that is going to run in a Linux environment. The troule is when I specify a boothclasspath or Classpath I need to use OS specific path seperators ";" for windows, and ":" for Linux. This happens because Java is still a native windows application and uses the native ...

Recording Memory Footprint In Linux

Is there a way we can record memory footprint? In a way that after the process has finish we still can have access to it. The typical way I check memory footprint is this: $ cat /proc/PID/status But in no way it exist after the process has finished. ...

How do I set $PATH such that `ssh user@host command` works?

I can't seem to set a new $PATH such that it is used when executing commands via ssh user@host command. I have tried adding export PATH=$PATH:$HOME/new_path to ~/.bashrc and ~/.profile on the remote machine, but executing ssh user@host "echo \$PATH" shows that the change has not been picked up (it shows /usr/local/sbin:/usr/local/bin:/u...

Shell Script: How to pass command line arguments to an UNIX alias?

How do I pass the command line arguments to an alias. Here is a sample: alias mkcd='mkdir $1; cd $1;' But in this case the $xx is getting translated at the alias creatin time and not at the runtime. I have, however, created a workaround using a shell function (after googling a little) like below: function mkcd(){ mkdir $1; cd...

how to split lines in unix log file output

Hello, I'd like to be able to parse date and times out of a log file. Currently they're in the following format: "02/Jun/2009:14:38:50" but i'd like to separate them in different columns using something available from a linux command line so that the resulting output looks as follows: "02/Jun/2009" "14:38:50" could someone please sh...

Handling FTP error codes

Most FTP clients return an exit code "0" even if an error occured during the file transfer. I am facing a problem, where in I am checking for the error codes. But my script gets the error code number in the bytes sent and the validation fails. I tried it like this: if [[ egrep '^202 |^421 |^426 |^450 |^500 |^501 |^503 |^530 |^550 |^5...