Monday, February 7, 2011

Command Prompt Basics

What is a command prompt?
A command prompt is a non-graphical interface that allows you to interact with your operating system. At the command prompt, you enter commands by typing their names followed by options and arguments. Most modern computers use a graphical user interface (GUI), which allows users to more intuitively access programs and documents. CMD is considered as most important and useful part of operating system. Every operating system eg. windows, linux, mac os, unix has its CMD and command line commands by which you can navigate through whole system and execute programs. Any program  which can be accessed by using graphical interface can also be assessed by using CMD and even much more , and the fact is that some programs and commands are available through a CMD only. Most of the hacks are done by command prompt. Windows OS provides good graphical interface which makes it easier to work and therefore any user without the knowledge of CMD can access the programs. But its not the case for linux OS and its distributions(ubuntu, fedora, backtrack, red hat etc). They can be used and programs can be accessed by the user having knowledge of CMD.
So, let us start with the commands in windows OS. To access the command prompt click on START MENU, select RUN, type CMD in it and there you are…
you will get a black box in which it is written something like this..
C:\Users\z3rocool>
it describes your current position in directories.. the above command line tells that you are in directory of z3rocool( here z3rocool is my user name, in your CMD it will be your user name)which is in the directory of USERS which is in C drive.
then type HELP, you will get the list of all possible commands in windows command line.
1) CD (change directory) command…
this command is used to change the positions in directories and navigate through them.
type cd..
C:\Users\z3rocool>cd..
click enter
C:\Users>
your position is shifted form z3rocool directory to users directory.
like wise again you can type cd.. you will be shifted in C drive like this,
C:\Users>cd..
C:\>
again if you want to go to USERS dir type CD USERS
C:\>cd users
C:\Users>
you will be in users dir again..
if you again want to go to z3rocool dir type CD Z3rocool
C:\Users>cd z3rocool
C:\Users\z3rocool>
you will be there…
for more functions which we can do by CD command type CD /? you will get the list of all possible CD commands…
2)DIR command
this command is used to list all files and folders in current directories…
C:\Users\zerocool>dir
Volume in drive C is Root Drive
Volume Serial Number is XXXXXXXX
Directory of C:\Users\zerocool
21-01-2011  AM 10:32   


          .
21-01-2011  AM 10:32              ..
17-01-2011  PM 06:53              Contacts
28-01-2011  AM 10:40              Desktop
23-01-2011  AM 10:22              Documents
17-01-2011  PM 07:35              Downloads
17-01-2011  PM 06:53              Favorites
17-01-2011  PM 06:53              Links
17-01-2011  PM 06:53              Music
17-01-2011  PM 06:53              Pictures
25-01-2011  PM 05:53              Saved Games
17-01-2011  PM 06:53              Searches
17-01-2011  PM 06:53              Videos
0 File(s)              0 bytes
13 Dir(s)  37,142,478,848 bytes free now to change the dir and go to any of dir listed above for ex take DESKTOP type  command CD DESKTOP
C:\Users\z3rocool>cd desktop
C:\Users\z3rocool\Desktop>
you will be in desktop directory, now to list all files and folders in this dir type DIR command..
C:\Users\z3rocool\Desktop>dir
Volume in drive C is Root Drive
Volume Serial Number is XXXXXX
Directory of C:\Users\z3rocool\Desktop
you will get the list of all the files an folders which currently on your desktop.. like wise you can go to VIDEOS, MUSIC, SAVED GAMES and so on…
also you can type DIR /B command which will list the files and folders only without any specifications like date and time which makes it easier to understand.
also you can use DIR /W command which will list the files in five columns.
again you can type DIR *. command to list each and every file in dir… it is mostly useful in seeing every file ie system files having ext  .rnd files but not hidden files and sub directories..
to view every file with sub directories type DIR /S
to view hidden files type command DIR /ah which means show all the files having attrib hidden..
for more functions which we can do by DIR command type DIR /? you will get the list of all possible DIR commands…
to be continued…..

No comments: