Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
2 votes
3 answers
6k views

Bash Script to remotely collect hostname, IP and host total memory

I am trying to write a scrip that will collect the hostname, IP and total memory installed on remote hosts from a list I feed into the script. The script will collect information from Redhat and ...
user315468's user avatar
4 votes
3 answers
7k views

awk in ssh command line complains 'unexpected newline or end of string' How to resolve?

While running the below script had an issue, ^ unexpected newline or end of string How could I resolve this ? [root@emrbldbgdapd2 ~]# ./collectdata.sh collect the data of 10.209.61.124 awk: cmd. ...
Levyle's user avatar
  • 41
5 votes
2 answers
14k views

Passing a list of two PIDs to xargs only kills the first using ssh

I'm retrieving a list of two PIDs that I want to kill. My pipeline looks something like ps -ef | grep foo | grep -v grep | awk {'print $2'} | xargs kill -9 Both processes are killed when executing ...
Steve's user avatar
  • 213
0 votes
1 answer
93 views

Why the number is rounded over ssh? [duplicate]

localhost:~ $ df -k / | awk '{print $3/1024/1024/1024}' 0 0.00618061 localhost:~ $ ssh localhost "df -k / | awk '{print $3/1024/1024/1024}'" 01 01
phar1no's user avatar
  • 31
2 votes
1 answer
3k views

awk in ssh in su in a command substitution

I am creating a script that will ssh to a host and print all the user accounts and when they will expire. On a host I can run awk -F':' '{ print $1}' /etc/passwd and it will give me a list of all ...
SpruceTips's user avatar