Wednesday, August 31, 2016

Display line numbers in a file

$ cat -n filename.txt

It will display line numbers on the left hand side for each line in a file


If you want to display line numbers in vi editor

$ vi +linenumber filename.txt

In command mode you just type :set nu to display line numbers

Friday, August 26, 2016

How to find device information in Android phone

Type *#*#4636#*#*

It will display all the phone and battery information on screen

Formatting date in Unix

For mm/dd/yy hh:mm:ss format

$ date +"%m/%d/%y : %r"
08/26/16 : 12:03:52


dd/mm/yy hh:mm:ss format

$ date +"%d/%m/%y : %r"
26/08/16 : 12:04:08


dd/mm/yyyy hh:mm:ss format

$ date +"%d/%m/%Y : %r"
26/08/2016 : 12:12:55


yyyy/mm/dd format

$ date +"%Y/%m/%d"
2016/08/26



Thursday, August 25, 2016

To find the IMEI code in Android phone

There are two ways to get the IMEI code in android phone

Type *#06#

It will display IMEI code on your screen

Another way is

Go to [Settings] -> [About Phone] -> [Status] -> [IMEI]

Wednesday, August 24, 2016

To find the software version of Nokia E72

Type *#0000#  It will display the software version information

Ex:

Software version
091.004

Sofware version date
02-Jan-2012

Custom version
091.004.C00.02

Custom version date
02-Jan-2012

Language set
40.01

Model
E72-1

Type
RM-123

Latest update
2/1/2012

To find the Serial Number or IMEI code in Nokia E-Series

Type *#06# to get the serial number of Nokia E-series

To find the Bluetooth device address of Nokia E-Series E72/E71/E5/E63

To get Bluetooth device address of Nokia E-series phone, type *#2820# 

It will display Bluetooth device address on screen

To find the Solaris version of the system

$ cat /etc/release

It will display the current Solaris version details

Combine content of two files in unix

$ cat file1 file2 > file3

It will combine both file1 and file2 content in file3. Here in above command it will overwrite in file3 if any content is existing.

If you wish to append the existing content in file3 you can use below command:

$ cat file1 file2 >> file3

Here if you use > it will overwrite and if you use >> it will append or add

To check Red Hat Linux version

$ cat /etc/redhat-release

It will display the current Red Hat Linux version as like below

Red Hat Enterprise Linux Server release 5.4

or you can use below command also to see the version

$ cat /etc/red*

or 

$ cat /etc/redhat\-release



Saturday, August 20, 2016

Creating multiple files in unix/linux

If you want to create a set of files like filename1, filename2,.., you can use touch command like below

$ touch filename{1,2,3}

$ ls -ltr
$ filename1 filename2 filename3

You could also use ranges to create multiple files

$ touch filename{1..5}

$ ls -ltr
$ filename1 filename2 filename3 filename4 filename5

You could also use any string of characters like below

$ touch {a..c}{1..5}

$ ls
a1  a2  a3  a4  a5  b1  b2  b3  b4  b5  c1  c2  c3  c4  c5

And you can use below command to remove set of files

$ rm -f {a..c}{1..5}

Friday, August 19, 2016

Nokia E72 Factory Reset

Nokia E72 - Factory reset command

Dial  *#7370#

It will ask lock code. Default lock code is 12345

Enter lock code and press [Ok]

Then, your phone will reset and restart in a while

Note: Factory reset will delete all your data from your phone

To check directory size in unix

$ du -sh *

It will display the size of all the directories, files in current directory

$ du -sh directoryname

It will display the total size of the given directory

Example:
$ du -sh dir*
$ 5G      dir1
$ 1G      dir2

Wednesday, August 17, 2016

vi Editor Save / Quit command

Following commands to Save or Quit from vi editor

ZZ or :wq - Save and exit from vi editor (Shift + ZZ)
:w - Save and continue to edit
:q! - Quit without saving changes