GNU netcat exit code always 1?

I'm trying to use GNU variant of netcat in script but it always returns exit code 1 even if everything is fine. Here's my case step by step: run nc -l 127.0.0.1 -p 7000 run nc 127.0.0.1 7000 press ctrl+c on client nc server nc always returns 1 It...
more »

2017-12-01 16:12 (1) Answers

bash variable expansion piped to ssh

I can't get my head around how to declare / refer to these variables in a shell script. Given the contents of commands_to_execute_on_remote.sh as: for c in 1 2 3 4 5 do supervisorctl restart broadcast-server-${ENVIRONMENT_NAME}-${c} done Wher...
more »

2017-11-28 14:11 (1) Answers

Using command & + disown instead of nohup

I've tried today to use the nohup command to execute an rsync command in order to process the copy of some files from a VM to another even if I close the console. Then I said why not using rsync [parameters] & + disown %1 What's the difference ...
more »

2017-11-27 19:11 (1) Answers

Paths must precede expression Linux find

I have the following command: find -xtype f -iname '*NEN*' -o '*1990*' I get the error "find: paths must precede expression: 1990" Why is this? I have quoted the wildcard, so I don't see the error. How to fix this? Thanks! ...
more »

2017-11-25 14:11 (1) Answers

Executing a for loop with gnu parallel

I'd like to use gnu parallel to exec a function inside a bash script in a for loop and I'm not able to figure out how from the info I got online . For example: #!/bin/bash get_racks(){ query that outputs a list of racks } get_hosts() { query that...
more »

2017-11-25 08:11 (3) Answers

Execute C language input file on linux

I don't understand how different between a. ./target <input b. ./target <$(cat input) c. ./target $(<input) ./target is a C program and input is a file or payload I want to know that how are they different and are there any more te...
more »

2017-11-22 08:11 (1) Answers

Replace String in a JSON file

"cassandra": { "host": "1.1.1.1", "portNo": "9042", "keyspace": "good" }, "postgres": { "host": "2.2.2.2", "portNo": "5432", "database": "dude", "username": "root", "password": "something" } This is a part of the jso...
more »

2017-11-21 13:11 (2) Answers

Find Command with multiple file extensions

I'm looking through many sub directories and finding all the files ending in .JPG .jpg and .png and copying them to a separate directory, however just now its only finding .JPG Could someone explain what i'm doing wrong? find /root/TEST/Images -nam...
more »

2017-11-16 22:11 (1) Answers

What is the fastest way to fill up disk space

I've got a big disk worth few TBs ( 5 TBs ) and i need fill up this disk space to about 95%, this is a linux centos box. I've tried dd as in dd if=/dev/zero of=o_File1.img bs=209715200 count=1000 even tried running in a loop like #!/bin/bash c...
more »

2017-11-16 10:11 (2) Answers

How get data back out of a (PHP) shell script

I'm running a PHP script in a larger shell script by doing php -f $filename > `basename $filename .php`.html Now I would like to let the script tell me which file extension to use for the output file name. I tried export AW_FILENAME_SUFFIX=".h...
more »

2017-11-14 19:11 (1) Answers