Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"free command not found" while running bash script using git bash

Tags:

shell

git-bash

I want to display server load, disk space, usage and memory usage in bash script.

But when I try

echo "Memory usage:"
memory_usage=$ free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
echo $memory_usage

this and run the script using ./test.sh it gives me the error:

free command not found

like image 416
Kim Jones Avatar asked Apr 20 '16 07:04

Kim Jones


People also ask

How do I fix bash command not found?

Install a package Sometimes when you try to use a command and Bash displays the "Command not found" error, it might be because the program is not installed on your system. Correct this by installing a software package containing the command.

How do I run a git bash command?

Launch Git Bash console by clicking on the Start button, type git, and click on Git Bash. 2. Run the below git config command to add your name ( YourName ) as your git username ( user.name ). The git config command administers configuration variables that control how Git looks and operates.

What is the command to execute run a bash script?

Using bash or sh This is the most standard way of executing the bash script. You must have git bash installed if you are using Windows. For Linux and macOS, bash is installed by default. In this method, we type bash followed by the file name with extension i.e. sh in this case.

What is available in free command in Linux?

The Linux free command outputs a summary of RAM usage, including total, used, free, shared, and available memory and swap space. The command helps monitor resource usage and allows an admin to determine if there's enough room for running new programs. In this tutorial, you will learn to use the free command in Linux.


1 Answers

for debian /ubuntu . just run

apt-get install procps 

for centos

yum install procps

the procps include free , top etc linux base commond

like image 130
tekintian Avatar answered Oct 07 '22 03:10

tekintian