search

Loading
Showing posts with label command line. Show all posts
Showing posts with label command line. Show all posts

Friday, May 31, 2013

Print sum of all numbers in a file in linux using awk

This is to print the sum of all numbers in a file using awk.

If the file which we want to process is sum.txt, and it's content is :

cat sum.txt
1
3
2
4
5


 To find the sum of all these numbers we can use below command:

Friday, March 23, 2012

Most useful screen shortcuts and commands in linux

Last time we saw about how to use screen and the advantages of screen. But there are more useful screen tips and tricks. Here I'm going to show you my most used screen commands.


As we saw we have created a screen session called 'backup' last time and logged in to that using screen -r backup or screen -x backup. But you need to remember that that is the name of that particular screen session. Inside a screen session we can have multiple screen windows. Not only that we can name each of these windows.

Friday, April 8, 2011

How to view UTC/GMT time in your terminal?

In this post we will see how to view the UTC/GMT (Coordinated Universal Time/Greenwich Mean TIme) in our terminal. We will be living in different time zones and we are using Greenwich Mean Time as the standard time to calculate time in other time zones. For example, I'm in Indian Standard Time and it is 5.30 hours ahead of GMT. So it is very common in internet to use UTC/GMT as a standard to tell about the time as people are in different time zones. So what if you do not know the time difference between your time zone and UTC/GMT?

We can find the UTC/GMT time from the terminal itself. For finding the UTC/GMT time type the following command in the terminal.
  • date -u
Thu Apr  7 20:14:20 UTC 2011



That's it. There is no need to search in internet to find out that.

Thursday, April 7, 2011

How to find the free space available in your hard disk using command line?

We can easily find the free space in our hard disk using command line. Command line, once we master it, is a lot easier than using Graphical User Interface(GUI), especially in linux. In linux, we have different Desktop Environment(DE) like Gnome,KDE,XFCE,Enlightenment etc which may be using different GUI based programs to find this simple free disk space. It may even change from distro to distro. So if we came from an entirely different linux distro or DE we will have to search for the specific program to view the free disk space. So what is the simplest and universal solution? Yes, it is command line which available in all the linux distros and have the same command to perform a specific task. So let's find out how find the free space using command line.

Friday, April 1, 2011

How to use your Linux Terminal as a stop watch timer?

Some times we may need to use a stop watch timer in order to calculate the time taken by something against some other thing to compare between two things. For example, if you need to check the speed of loading pages between Firefox 4 and Google chrome in linux.

As you are using linux, there is always a simple and better way to do this. For doing this you do not have to install a separate software. You can use your terminal as a stop watch timer. Yes, you have heard it right. I repeat " You can use your terminal as a stop watch timer". Let's have a look at how to use the terminal as stop watch timer.