title: Linux - Calculate session duration and add it to your prompt
body: <p>Is there a way to calculate what is the session duration or the length of the session for the current user?</p>
  
  <p>I know using <code>last</code> command we can get the login and idle times of the user but is there a direct command or any math that can be done to calculate from time now to time when the user had logged in.</p>
  
  <p>Also how to add this session duration info in the prompt. I know using <code>export PS1</code> it can be achieved but what would be the parameter that will go in?</p>
  
  <p>Any help is appreciate. Thanks.</p>