Correctly Measure Available Memory In Linux

I'm currently using the command below, to output the memory usage of a debian system in bash scripts.

Code:
memusage=$(memusage=$(/usr/bin/free | grep Mem | awk '{print $3/$2 * 100.0 "%"}' | cut -d "%" -f1);echo "$(printf "%0.0f\n" $memusage)") && echo Memory Usage is $memusage

Being new to Linux though, I just found out that Linux takes up a lof of memory and puts it in cached.

Code:
root@Client1:~# free -m
             total       used       free     shared    buffers     cached
Mem:           927        799        128          0         15        754
-/+ buffers/cache:         28        898
Swap:           99          0         99

So the first command will actually output that the memory usage is 87%, when in reality is not. Its actually thinking that the memory usage is high because its also counting the cached memory, as used memory.

How can I modify the first command not to consider cached memory, as used memory?

Thanks


Similar Content



Equivalent Command For "time -v" In Centos

I want to know the approximate maximum memory usage by my process. If I start the process using "time -v <myprocess>", I get the output after it terminates. This works fine in RedHat Enterprise Linux, but not in Centos. There does not seem to be an option "-v" for time. Do I miss anything ? What is the equivalent in Centos to know the peak memory usage by a process ?

Memory Rises To Maximum

I have a running jboss application server 5 on RHEL 6.After few days it is noticed that the memory usage is at maximum.When the services of jboss are restared all of the memory is left free?I am unable to diagnose the issue?
Memory assigned is 24GB heap size is 16 GB.

CPU & I/O Memory Usage

I have this question which give me a file.tar.gz which include a calculator file and want to extract and run it
in the output it wants to show
1)cpu avg usage
2)total time taken to run
3)memory and I/O usage
can anyone help???

Changing The Output Of CPU And RAM Usage

I am using the following two commands to output CPU and RAM usage on a Linux machine.

Code:
/bin/grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'

/usr/bin/free | grep Mem | awk '{print $3/$2 * 100.0 "%"}'

My problem is that the output is like this

Quote:
5.33672%
13.9723%
Is there a way to output a single number? For example

Quote:
5
13
Thank you

Silly Memory Question

Hello,

So I'm not sure if this is a real issue, my understanding is that when a system reboots the virtual memory is dumped in the process. Is there some configuration that would keep the memory intact after rebooting? I'm on RedHat 6 enterprise server, and I just need to make sure that virtual memory is cleared upon reboot. I'm not sure where to look to make sure this is happening.

thank you.

Blackscreen Installing Debian Jessie Upgrading From Debian Wheezy

OK, I've created my user, I read all the post like: "Sticky: Please READ this before posting!" and the recommended post.

This morning I tried to upgrade my Debian Wheezy to Debian Jessie. I took a while to read the release-notes, change the source.list typing "jessie" in order of "wheezy".

Then, I opened a script with:

# script -t 2>~/actualiza-a-jessie01.time -a ~/actualiza-a-jessie01.script

and, finally:

# apt-get dist-upgrade

The installation started and all was go on until the postgresql when the installation stops and there was nothing to do. A lot of time after I decide restar the computer but now it doesn't start.

Appears the Debian 8 start menu with:
GNU GRUP versión 2.02

And the menu options:
Debian GNU/Linux
Opciones avanzadas para Debian GNU/Linux
Memory test (memtest86+)
Memory test (memtest86+, serial console 115200)
Memory test (memtest86+, experimental multiboot)
Memory test (memtest86+, serial console 115200, experimental multiboot)

When I select GNU/Linux I only get:
Loanding, please wait...
fsck from util-linux 2.25.2
/dev/sda1: clean, 619892/30269440 files, 68856006/121052672 blocks

and then.... nothing.

What can I do to restore my computer?

Thanks in advance.

Samsung R40 Laptop Upgrade?

I don't know if anyone can help with this question, but I have an old Samsung R40 Laptop which used to run Windows XP. The specs show that it will not upgrade to Windows 7,8 or any other OS beyond XP. Yesterday I wiped the HDD clean and installed Linux Mint 17.1 Cinnamon which looks good and runs a little slowly but without problems. The Laptop is in good condition therefore I thought I would upgrade it by adding more memory to speed it up. The Memory installed is 2x512mbs PC2-3200S-333 DDR2 200pin, unfortunately I have not been able to obtain any. I would like to double the memory to 2x1gb (2056mbs). If anyone knows for certain where I can get this memory (or Compatible) in the UK or Europe I would be most grateful.

Thanks,

gael.

Problem With Zorin And Steam; Can't D/l Most Games.

Hello, y'all with vast Linux knowledge, I've built my own gaming desktop, here are the specs:
1-MOBO Asus M5A78L-M LX Plus
2-AMD Radeon Graphics R9 270, 2GB DDR5 Memory
3-2 Hyper X Memory Cards totalling 16 Gb of RAM

Have installed and runninbg Zorin 9.0 Ultimate (Ubuntu 14.4) - MY PROBLEM, I am unable to downlolad any games especially "Minecraft", "League of Legends" and a host of other games on "Steam". I have Wine Geko (32 bit) 2.1 version installed and have Winetricks as well, when I open it I can install a host of games, however, nothing is installed. This is the last straw for me, I have no clue what to do do being a Newbie and unfortunately the folks at "Zoringroup/helpdesk" have been absolutely useless as well. Thanks.

Not Enough Memory Msg When Install'g Mint Or Deepin

Hi Y'all,
Greetings from Snowy NC.

First post with first Linux issue.
Attempting to load Linux .iso distros (both dnlds and commercial (from mags & bought sampler cd pkg online) to see which one I want to go with.
My ACER M3011 desktop athlon 64 x2 w/2GB Mem, dsk =320GB had Vista but I can't restore any longer so I'll go Linux.
After much online research dnlded & installed Zorin Lite w/o issues. However, when attempting to boot 32bit or 64 bit versions of MINT 17.1 or DEEPIN 14.2, recvd NOT ENOUGH MEMORY FOR IMAGE msg. Installed 4 more GB ( the BIOS sees it; total 6). Same NOT ENOUGH MEMORY msg. I have searched all the threads for similar issues w/o finding any. I would appreciate suggestions on where to start.
Thank you, Robert Hall

UPDATE;; After finding suggestions on other forums have tried the trick of adding the mem=1024m, and mem=1G, and mem=4G
during the boot process. Get a whole bunch further into the kernal boot now, but always hangs at the "[7.360454] random:
nonblocking pool is initialized" line.
TIA
RH

Linux Black Desktop Screen (elementaryOS)

I recently installed elementaryOS and everything was working fine until I changed the drivers in the Additional Drivers section.
I then tried changing back to the drivers previously used and others but to no avail. I can see the menu bar at the top and run applications, but the whole desktop just appears black.

Here is some info.

Code:
01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 310] (rev a2)

  *-display               
       description: VGA compatible controller
       product: GT218 [GeForce 310]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a2
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:44 memory:fa000000-faffffff memory:d0000000-dfffffff memory:ce000000-cfffffff ioport:ec00(size=128) memory:fbe80000-fbefffff
[1]+  Done                    lspci | grep --color=auto VGA

How can I fix this issue?