-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bcc278e
commit 2d38a2e
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
# | ||
# SCRIPT: freemem-awk | ||
# AUTHOR: Vidushi Bansal | ||
# DATE: 31/08/2020 | ||
# REV: 1.1.A (Valid are A, B, D, T and P) | ||
# (For Alpha, Beta, Dev, Test and Production) | ||
# | ||
# | ||
# PLATFORM: UBUNTU | ||
# | ||
# PURPOSE: Using awk command to check the memory status. | ||
# REV LIST: | ||
# DATE : Date of revision | ||
# BY : AUTHOR OF MODIFICATION | ||
# MODIFICATION: Describe the chages made. What do they enhance. | ||
# | ||
# set -n # Uncomment to check script syntax, without execution. | ||
# # NOTE: Do forget comment it back as it won't allow the | ||
# # the script to execute. | ||
# | ||
# set +x # Uncomment this for debugging this shell script. | ||
# | ||
# | ||
################################################################ | ||
# Define Files and Variables here # | ||
fileName="/proc/meminfo" | ||
totalMemory=$(awk '/MemTotal/{print}' $fileName) | ||
freeMemory=$(awk '/MemFree/{print}' $fileName) | ||
availableMemory=$(awk '/MemAvailable/{print}' $fileName) | ||
buffers=$(awk '/Buffers/{print}' $fileName) | ||
cached=$(awk '/^Cached/{print}' $fileName) | ||
|
||
################################################################ | ||
################################################################ | ||
# Define Functions here # | ||
|
||
display(){ | ||
echo "Total memory available in the system: $totalMemory" | ||
echo "Free memory available in the system: $freeMemory" | ||
echo "Memory available in the system: $availableMemory" | ||
echo "Buffer available in the system: $buffers" | ||
echo "Cache memory available in the system: $cached" | ||
} | ||
|
||
################################################################ | ||
################################################################ | ||
# Beginning of Main # | ||
display | ||
################################################################ | ||
# End of script | ||
|
||
|