Wednesday, October 17, 2012

Twelfth session of Some of basic UNIX commands that are useful very frequently


Today we will discuss about some more commands that are used very frequently in UNIX/LINUX based systems.

echo is a command used to print any argument that we give. Basically this command is very useful when one want to write shell script(.sh) like batch script(.bat) that we used to write in Windows based systems.

echo argument

Above command will display 'argument' in the terminal. So, while writing shell script and want to debug/log user given argument then, we use this. Its similar to 'System.out.println' that we use in Java to print some thing.

file is a command used to determine type of file by examining its content.

file .bash_profile

Above command will display classification of file named '.bash_profile' present in home directory i.e. /home/ by examining its content. Below is its output:

$ file .bash_profile
.bash_profile: ASCII text


head is a command used to display first few lines of file specified as an argument.

head filename

Above command will display first few lines of a file named 'filename' present in current working directory. Below is output of head command executed on file named 'terimerilyrics':

$ head terimerisonglyrics
Aa......

Teri meri, meri teri prem kahani hai mushqil
Do lafzoon mein yeh bayaan na ho paaye
Ik ladka ik ladki ki yeh kahani hai nayi
Do lafzoon mein yeh bayaan na ho paaye

Teri meri, meri teri prem kahani hai mushqil
Do lafzon mein yeh bayaan na ho paaye
Ik dooje se huey juda Jab ik dooje ke liye bane


As conveyed in previous posts, don't hesitate to try these commands. We will discuss about some more useful commands in next posts.

No comments: