Programming in UNIX Environment : Commands – echo, rm, whoami

Take a look to the following UNIX commands.
who am i -This command shows your user name,teletype,date and time.

whoami – Shows only user name.

In UNIX systems,

parent directory is denoted by ‘..’
current directory is denoted by ‘.’

rmdir – for remove a directory. It removes only empty directories.

About shell :

When we type the commands it goes to the shell.It is an ordinary program.

cat c* //prints all file that begins with c.

when * occurs shell takes it and it means any string of characters. Note the * is not the property of the cat command.

The echo command lists what we type.

echo word

echo ch* //lists all begin wth ch.

echo * //lists all.

rm * – removes all.

rm *.text – removes all with .text.

pr r[1234]* // prints all that begin wth r and followed by 1,2,3 or 4.

rm te[a-z] //removes all files starting with te and followed by a lower case.

You cannot make up new files using pattern matching.

ls \? or ls ‘?’ loses its meaning.

echo * // prints all.

We can redirect the output by using ‘>’. Take input from a file by using ‘>’.

ls > filelist

pr -3 <filelist // print ls in three columns.

cat file1.c file2.c > file3

cat file4.c >> file3.c

grep num.c <filelist


Author: Abhi

Hi, this is Abhilash - Senior Programmer Analyst at CoMakeIT, specialised on web programming. Mainly working on Ruby On Rails platform since 2010.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s