DOS / UNIX Commands

This post contains very useful and commonly used DOS / UNIX Commands.

Command: VER

Description: It displays the version of the operating system 
Syntax: C:\> VER
Example Output: Microsoft Windows [Version 5.1.7601]

Command: DATE

Description: It displays current date and asks for new date in (mm)-(dd)-(YY) format. If no date is to be changed, the old date can be retained by pressing enter key.
Syntax: C:\> DATE
Example Output:
The current date is: 10/08/2012
Enter the new date: (mm-dd-yy)

Command: TIME

Description: It displays the current time and asks for a new time and if no new time is to be entered, pressing enter retains the old time.
Syntax: C:\> TIME
Example Output:
The current time is: 21:38:51.06 

Command: TITLE

Description: Sets the window title for the command prompt window. 
Syntax: C:\> TITLE [string]
where "string" specifies the text to set the title. 
Example Output:
TITLE CPNMLAB
CPNMLAB —  X
C:\> TITLE CPNMLAB

Command: CLS

Description: It clears the screen
Syntax: C:\> CLS
Example Output: Screen gets cleared and displays C:\> at the top

Command:[DRIVE]:

Description: To change the drive letter in MS-DOS, type the drive letter followed by a colon.
Syntax: C:\> [drive]:
Example Output:
C:\> D: {changes the drive letter from C to D} D:\> 

Command:MD

Description: It is used to make a new directory (or sub-directory) that is subordinate to the current (or root) directory.
Syntax: C:\> MD <directory_name>
Example Output: C:\> MD IT_24

Command: CD

Description: It is used to change from one directory to the other. 
Syntax: C:\> CD <directory_name>
Example Output: 
C:\> CD code
C:\code>

Command: CD..

Description: Goes back to one directory. 
Syntax: C:\DIRECTORY_NAME>CD.. 
Example Output:
C:\code>CD.. 
C:\>

Command: CD\

Description: Goes to the highest level, the root of the drive. 
Syntax: C:\DIRECTORY_NAME\SUB_DIRECTORY>CD\ 
Example Output:
C:\Documents and Settings\User>CD\ 
C:\>

Command: COPY CON

Description: It allows the creation of a file through a command prompt. 
Syntax: COPY CON <FILENAME>.<EXTENSION>
Example Output:
D:\code> COPY CON sample.txt Name: Ram
Branch: IT
Rank: 1100
College: ABC
^Z [Ctrl + Z]
1 file(s) copied. 
D:\code>

Command: TYPE

Description: Displays the contents of a text file or files. 
Syntax: TYPE [drive:\path\filename]
Example Output:
D:\code> TYPE sample.txt Name: Ram
Branch: IT
Rank: 1100 
College: ABC
D:\code

Command: EDIT

Description: Edit allows a user to view, create, or modify their computer files. 
Syntax: EDIT [drive:\path\filename]
To Save the file Press Alt + F, and a menu appears that contains the "Save" option. To Exit the file Press Alt + F, and a menu appears that contains the "Exit" option.

Command: DIR

Description: displays continuously a list of files and subdirectories in a directory, displays the total number of files, directories, bytes used, and remaining bytes (storage).
Syntax: D:\> DIR [drive:]
D:\> DIR F: {displays a list of files and directories from F drive.}

Command: DEL

Description: Deletes a specified file.
Syntax: DEL {filename}

Command: REN

Description: Changes the name of an old file with a new name. 
Syntax: REN old_file_name new_file_name

Command: COPY

Description: Copy files from one place to another.
Syntax: COPY [drive:\path]<source file> [drive:\path]<destination>

Command: COLOR

Description: Sets the default console foreground and background colors.
Syntax: COLOR [attr] 
where attr specifies a color attribute of console output.

Command: COMP 

Description: Compares contents of two files. 
Syntax: COMP filename1 filename2 

Command: FC

Description: Compares two files and displays the difference between them. 
Syntax: FC filename1 filename2

Command: MORE

Description: Allows information to be displayed one page at a time. Displays a text file to the screen.
Syntax: MORE filename
DIR | MORE

Command: START

Description: Starts a separate window to run a specified program or command. 
Syntax: START [title] [/d path]

Command: FIND

Description: Searches for a Text String in a file 
Syntax: FIND [OPTION] "string" file

Command: EXIT 

Description: Quits the CMD.EXE program (command interpreter). 
Syntax: EXIT

Command: ATTRIB

Description: Displays or changes file attributes.
Syntax: ATTRIB [+R | -R] [+H | -H] [drive:][path][filename]

Command: PROMPT

Description: Changes the cmd.exe command prompt. 
Syntax: PROMPT [text] $G

Command: PATH

Description: Displays or sets a search path for executable files & used to provide access to files located in other directories.
Syntax: PATH = “[[drive:]path”;

Command: SORT 

Description: Sorts input in alphanumeric order.

Command: TREE

Description: Displays the directories and subdirectories existing in a drive in a Tree diagram without files. Only directories with <DIR> are displayed.
Syntax: TREE

Comments