05 January 2012

General Commands You Should Know in Linux/Unix

Leave a Comment
General Commands You Should Know in Linux/Unix(3rd part)


GO TO FIRST PART
GO TO SECOND PART


13. which : which command display absolute path of the command.

Syntax


                     which command-name


Example


$ which ls
/bin/ls
$ which firefox
/usr/bin/firefox
$

                     


14. whatis : whatis command display the purpose of command in one line.



Syntax


                     whatis command-name


Example


$ whatis reset
reset (1) - terminal initialization
$ whatis clear
clear (1) - clear the terminal screen
$





15. printf : just like echo , printf  can be  used to  display message.

Syntax


                  printf message


Example


                 printf "my name is sandeep\n"              // \n to move the cursor in next line

$ printf "my name is sandeep"
my name is sandeep$ printf "my name is sandeep\n"
my name is sandeep
$

*printf uses many of the format used in C like


%s - string
%d - integer
%x - Hexadecimal Integer
%o - Octal integer
%f - floating point number
%10s - string 10 character wide


$ printf "the value of %d in octal is %o \n" 255 255
the value of 255 in octal is 377

$ printf "the value of %d in hexadecimal is %x \n" 354 354
the value of 354 in hexadecimal is 162

$ printf "my name is %s \n" sandeep
my name is sandeep
$




If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

0 comments:

Post a Comment