<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Linux on Akshay Deshpande</title>
    <link>https://akshayd-dev.pages.dev/categories/linux/</link>
    <description>Recent content in Linux on Akshay Deshpande</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 22 Aug 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://akshayd-dev.pages.dev/categories/linux/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>[Memory-metrics]: Linux /proc interface</title>
      <link>https://akshayd-dev.pages.dev/posts/memory-metrics-linux-proc-interface/</link>
      <pubDate>Mon, 22 Aug 2022 00:00:00 +0000</pubDate>
      <guid>https://akshayd-dev.pages.dev/posts/memory-metrics-linux-proc-interface/</guid>
      <description>&lt;p&gt;This writeup is more of a demo to showcase the power of &amp;ldquo;&lt;code&gt;proc&lt;/code&gt;&amp;rdquo; (process information pseudo-filesystem) interface in linux to get the memory details of process, and also a quick brief on the power of &amp;ldquo;proc interface&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;In the current trend of building &lt;em&gt;abstraction over abstractions&lt;/em&gt; in software/tooling, very few tend to care about the source of truth of a metrics. There are various APM / Monitoring tools to get the memory details of a process for a linux system, but when the need arises, I believe, one must know the ways of going closer to the source of truth on a linux system and verify things.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Docker: A list of most frequently used commands</title>
      <link>https://akshayd-dev.pages.dev/posts/docker-a-list-of-most-frequently-used-commands/</link>
      <pubDate>Thu, 07 Apr 2022 00:00:00 +0000</pubDate>
      <guid>https://akshayd-dev.pages.dev/posts/docker-a-list-of-most-frequently-used-commands/</guid>
      <description>&lt;p&gt;This writeup is a dump of my study notes on most frequently used docker commands for reference. This is just a self reference page and will get updated on the go&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To run a container from an image&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run &amp;lt;image name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To run a docker image with a specific tag. Example below of pulling redis image with tag4.0. You will get these tag details on the dockerhub page for the image&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run redis:4.0
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To run a docker image in detached mode&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run -d &amp;lt;image_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To run a docker image and login to the container directly&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run -it &amp;lt;image_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To list all the docker images&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker images
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To pull a docker image from dockerhub but not run it.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker pull &amp;lt;image_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To list all the docker containers&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker ps -a
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To stop a docker container&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker stop &amp;lt;container_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To remove a docker container form the disk.&lt;br&gt;
Note: This will remove the container permanently. It will not list anymore in &lt;code&gt;docker ps -a&lt;/code&gt;. However, the image still exists. The exited/stopped containers do not consume any CPU or memory, but they still use the machine&amp;rsquo;s disk space.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker rm &amp;lt;container_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To remove a docker image&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker rmi image
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To execute a command in a running docker container&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker exec &amp;lt;container_name&amp;gt; &amp;lt;command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To get the ip of a docker container&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker inspect &amp;lt;container_id/container_name&amp;gt; | grep IPAddress
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To map the internal port of a docker container to a host port&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run -p 80:5000 &amp;lt;image_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To get the logs of a container&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker logs &amp;lt;container_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To build a docker file&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker build . #from being in the dir which has Dockerfile
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;To map an external directory at the bootup to a docker container&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;docker run -v /myCustomdir:/defaultDir -u root imageName
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>[Performance] : Understanding CPU Time</title>
      <link>https://akshayd-dev.pages.dev/posts/performance-understanding-cpu-time/</link>
      <pubDate>Sat, 24 Jul 2021 00:00:00 +0000</pubDate>
      <guid>https://akshayd-dev.pages.dev/posts/performance-understanding-cpu-time/</guid>
      <description>&lt;p&gt;As a Performance Engineer, time and again you will come across a situation where you want to profile CPU of a system. The reasons might be many; like, CPU usage being high, you want to trace a method to see its CPU cost or you suspect CPU times for a slow transaction.&lt;/p&gt;
&lt;p&gt;You might use one of the various profilers out there to do this. (I use &lt;a href=&#34;https://www.yourkit.com/docs/kb/&#34;&gt;yourkit&lt;/a&gt; and &lt;a href=&#34;https://www.linkedin.com/pulse/jprofiler-cpu-profiling-akshay-deshpande/&#34;&gt;Jprofiler&lt;/a&gt;). All these profilers report the CPU costs in terms of CPU Time, when you profile the CPU. &lt;em&gt;This time is not the equivalent of your watch time.&lt;/em&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Shell Scripting - Functions [Part2]</title>
      <link>https://akshayd-dev.pages.dev/posts/shell-scripting-functions-part2/</link>
      <pubDate>Sun, 06 Oct 2019 00:00:00 +0000</pubDate>
      <guid>https://akshayd-dev.pages.dev/posts/shell-scripting-functions-part2/</guid>
      <description>&lt;p&gt;This post is a followup on the first article - basics of Shell scripting [&lt;a href=&#34;https://wordpress.com/block-editor/post/performanceengineeringin.wordpress.com/113&#34;&gt;here&lt;/a&gt; - note: increasing the scope beyond Performance Engineers only].&lt;/p&gt;
&lt;p&gt;In this write up we look at how to modularize a shell script using &lt;em&gt;Functions&lt;/em&gt; and how to create a &lt;em&gt;set of useful functions&lt;/em&gt; -&amp;gt; convert them in to &lt;em&gt;library&lt;/em&gt; -&amp;gt; &lt;em&gt;use them across&lt;/em&gt; scripts.&lt;/p&gt;
&lt;h4 id=&#34;functions&#34;&gt;Functions:&lt;/h4&gt;
&lt;p&gt;It is a good practice to write shell scripts as functions rather than stand alone scripts so that they can be easily incorporated in to other scripts without incurring the overhead of system calls. While there is no &lt;em&gt;import&lt;/em&gt; feature like in Python, there are capabilities of &lt;em&gt;Sourcing&lt;/em&gt; files is shell scripts.&lt;br&gt;
But first, lets look at ways of writing functions and invoking them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Shell Scripting for Performance Engineers and others - [Part 1]</title>
      <link>https://akshayd-dev.pages.dev/posts/shell-scripting-for-performance-engineers-and-others-part-1/</link>
      <pubDate>Tue, 30 Apr 2019 00:00:00 +0000</pubDate>
      <guid>https://akshayd-dev.pages.dev/posts/shell-scripting-for-performance-engineers-and-others-part-1/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Performance Engineers&lt;/strong&gt; go through a set of manual tasks time and again. Be it for creating data for the load test, triggering of the test in a particular sequence / at a particular time or post processing of data collected after the test.&lt;br&gt;
The general rule of thumb is - &lt;em&gt;anything that takes more than 10 minutes and has to be done more than two times a week has to be automated&lt;/em&gt;. That is a minimum of 1040 minutes saved per year - 2 working days / year per person.&lt;br&gt;
To achieve automation, although the world has come to Python &amp;amp; Scala for sophisticated solutions, quick and dirty Shell Scripts will never go out of style. I would not go for sophisticated / complex solutions, if the same can be attained in less than 20-lines of a quick Shell Script.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
