How to get the memory usage by bytes using script
up vote
0
down vote
favorite
I have a script and I need to modify this so it can print the memory usage into the file with bytes.
#!/bin/bash
echo "$HOSTNAME, timestamp=$( date +%s ), free -b" >> "system_monitor.csv"
command-line bash scripts
add a comment |
up vote
0
down vote
favorite
I have a script and I need to modify this so it can print the memory usage into the file with bytes.
#!/bin/bash
echo "$HOSTNAME, timestamp=$( date +%s ), free -b" >> "system_monitor.csv"
command-line bash scripts
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a script and I need to modify this so it can print the memory usage into the file with bytes.
#!/bin/bash
echo "$HOSTNAME, timestamp=$( date +%s ), free -b" >> "system_monitor.csv"
command-line bash scripts
I have a script and I need to modify this so it can print the memory usage into the file with bytes.
#!/bin/bash
echo "$HOSTNAME, timestamp=$( date +%s ), free -b" >> "system_monitor.csv"
command-line bash scripts
command-line bash scripts
edited Nov 20 at 9:54
asked Nov 20 at 9:47
Onyic
335
335
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
What your script should look like is this:
#!/usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b)" >> "system_monitor.csv"
The timestamp
variable is unnecessary in this case. And I would suggest adding two news line or one to make the output readable. So a better command would be:
#! /usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b) \n \n" >> "system_monitor.csv"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
What your script should look like is this:
#!/usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b)" >> "system_monitor.csv"
The timestamp
variable is unnecessary in this case. And I would suggest adding two news line or one to make the output readable. So a better command would be:
#! /usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b) \n \n" >> "system_monitor.csv"
add a comment |
up vote
0
down vote
accepted
What your script should look like is this:
#!/usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b)" >> "system_monitor.csv"
The timestamp
variable is unnecessary in this case. And I would suggest adding two news line or one to make the output readable. So a better command would be:
#! /usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b) \n \n" >> "system_monitor.csv"
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
What your script should look like is this:
#!/usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b)" >> "system_monitor.csv"
The timestamp
variable is unnecessary in this case. And I would suggest adding two news line or one to make the output readable. So a better command would be:
#! /usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b) \n \n" >> "system_monitor.csv"
What your script should look like is this:
#!/usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b)" >> "system_monitor.csv"
The timestamp
variable is unnecessary in this case. And I would suggest adding two news line or one to make the output readable. So a better command would be:
#! /usr/bin/env bash
echo -e "$HOSTNAME, $(date +%s), \n $(free -b) \n \n" >> "system_monitor.csv"
edited Nov 20 at 16:21
answered Nov 20 at 10:06
George Udosen
18.5k94265
18.5k94265
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1094465%2fhow-to-get-the-memory-usage-by-bytes-using-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown