Get MINUS data beween two files in UNIX

I have two files in Unix. File 1 contain: 1.- Jhon 2.- Peter 3.- Marie File 2 contain: 2.- Peter 5.- Luouis I want to create a new file from these two file. The result that I want is: File 3: 1.- Jhon 3.- Marie Basically the result is like next below: But unfortunately, the result is like this: File…
Read more

Why is printf before exevp not running?

I get an output of “hi!”. Why is this not also printing “something”? #include <stdio.h> #include <unistd.h> int main(int argc, char** argv) { char* program_name = “echo”; char* args[]= {program_name,”hi!”,NULL}; printf(“something”); execvp(program_name,args); return 0; } I know I’m not creating a child process first. If I take out the execvp line, it works as expected. Weird. (Note: “echo” refers to…
Read more

Explain plan statement in db2 not working using shell script

I have used the below statement in my script to get the explain plan for a stored procedure but its throwing error a=db2 -x “SELECT current timestamp FROM sysibm.sysdummy1″ c=echo $a|cut -d”.” -f1-2 time_new=”‘$c%’” db2exfmt -d ${DATABASE} -e ${DATABASE} -g -l -n -s ${SCHEMA_NAME} -o SP_explain_plan_${TIMESTAMP}.out -w ${time_new} -# 0 -v % Its not able to read the timestamp correctly….
Read more

GNU unix version 8.4 join to ignore firstline(Header)

I have two CSV files to be joined on a column, I am using unix ‘join’ command, I want to ignore the header while joining, I was using ‘–header’ option in GNU core utils v8.21, but my product machine has core utils v8.4, ‘–header’ is not available in GNU core utils 8.4, I cannot upgrade the core utils in production…
Read more

Create an SSH tunnel on the server that needs to access the remote application port

I am developing nodejs application. And also new Linux systems. I installed RethinkDB to google compute engine instance. I can access to 28015 driver port locally. But I can not access to the driver port (28015) so that it cannot be accessed from the outside world. So I did it below commands. But I got some errors. test@rethinkdbserver:~$ sudo iptables…
Read more

Exec() and Fork()

So i created a c program in unix. This is what it does. 1)It forks a process. Child Process: Performs execv() on a alarm clock program which prints “Alarm rang” after ‘x’ seconds Parent Process: Performs waitPID on child above. Then exits. Output: So i ran it and i received the “Alarm rang after x seconds” Everything is working fine….
Read more

How to assert that there are no threads in a Linux program? ie, to assert that it is an appropriate time to call fork

How do I use C within a program to assert that there are no threads (for example, by listing and counting them if necessary)? I want to write a program that forks early-on before any threads are created but I want the application to abort if another developer changes a module in a way that a thread is created before…
Read more

Plan task for network with unix systems

For example i have an enterprize network in my company where all of corporate PC is running our unix-based OS. There is a way to send for each PC in network admin’s script and add record in cron scheduler to execute this script? Source: unix

Linux command ps aux

Someone could tell me what this commands mean? ps aux | grep -v ‘grep’ | grep -v ‘/bin/sh’ If im right ps aux is for displaying all the processus of the system grep -v ‘grep’ is for displaying the lines which doesn’t contains the grep word. Same for the ‘/bin/sh’. But what this means “|” I don’t understand Source:…
Read more