Monday, September 17, 2012

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


Today we will discuss about some more useful commands that are used very frequently when you work with UNIX/LINUX based Operating Systems.

mkdir is a command which created new directory in your file system.

mkdir NewDirectory

Above command will create new folder named 'NewDirectory' in present working directory. You can fetch your present working directory by hitting 'pwd' in your terminal. For suppose you are in directory '/home/x/y' then new directory named 'NewDirectory' will be created in ' /home/x/y'.

mkdir /x/y/z NewDirecotory

Above command will create new folder named 'NewDirecotry' in the path '/x/y/z'.

Similarly you can remove a folder and its contents by using command rmdir.

rmdir NewDirectory

Above command will deletes/removes a folder named 'NewDirectory' from current working directory. If that directory contains any sub folders/files then will confirm from user before deleting each file/folder with 'Y/N ?'. So, you can remove/delete each file/folder by pressing 'y'.

rmdir -f NewDirectory

Above command will deletes/removes 'NewDirectory' and its contents without asking confirmation to delete.

rmdir -f /home/x/y/*

Above command will deletes/removes content (files/sub folders) in the path '/home/x/y' without asking confirmation to delete. Like '*', we can use patterns to delete files. Below is small example:

rmdir -f /home/x/y/a*.java

Above command will deletes/removes files whose names starts with 'a' and extension '.java' in the path '/home/x/y/'.

Don't hesitate to try these when you are free.. If you already had a chance to try these, then don't hesitate to write your valuable comments. Will discuss some more in next post....

No comments: