0% found this document useful (0 votes)
576 views6 pages

DOS Info

This cheat sheet summarizes common MS-DOS commands and their Linux equivalents. It lists over 30 commands, providing a brief description of each command's functionality and sample code snippets showing command syntax in both MS-DOS and Linux. The commands cover a wide range of functions including file management, disk management, environment configuration, and more.

Uploaded by

cristi_pet4742
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
576 views6 pages

DOS Info

This cheat sheet summarizes common MS-DOS commands and their Linux equivalents. It lists over 30 commands, providing a brief description of each command's functionality and sample code snippets showing command syntax in both MS-DOS and Linux. The commands cover a wide range of functions including file management, disk management, environment configuration, and more.

Uploaded by

cristi_pet4742
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Cheat Sheet of MSDOS

DOS Description Equivalent LINUX Sample Code Snippet


Command Commands (Case
sensitive)

ASSOC Displays or modifies file extension associations. N/A assoc


ATTRIB Displays or changes file attributes. chmod attrib -s -r -h <filename>
BREAK Sets or clears extended CTRL+C checking. N/A BREAK [ON | OFF]
BCDEDIT Sets properties in boot database to control boot grub* bcdedit /export <SomeFile>
loading.
CACLS Displays or modifies access control lists (ACLs) of files. chmod and chown cacls <SomeDirOrFile> /g <username>:f
CALL Calls one batch program from another. exec call <SomeBatchFile>
CD/CHDIR Displays the name of or changes the current directory. cd cd <SomeDir>
CHCP Displays or sets the active code page number. N/A chcp
CHKDSK Checks a disk and displays a status report. fsck chkdsk <SomeDrive>:
CHKNTFS Displays or modifies the checking of disk at boot time. fsck chkntfs <SomeDrive>: <Parameters>
CLS Clears the screen. clear cls
CMD Starts a new instance of the Windows command bash/tcsh/zsh/ksh cmd
interpreter.
COLOR Sets the default console foreground and background color A
colors.
COMP Compares the contents of two files or sets of files. diff comp <File1> <File2>
COMPACT Displays or alters the compression of files on NTFS N/A compact
partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert the N/A CONVERT <drive>: /FS:NTFS
current drive.
COPY Copies one or more files to another location. cp copy <SourceFile> <DestFile>
DATE Displays or sets the date. date date /T
DEL Deletes one or more files. rm –iv del <filename>
DIR Displays a list of files and subdirectories in a directory. ls –l dir <path>
DISKCOMP Compares the contents of two floppy/removable disks. N/A diskcomp a: b:

DISKCOPY Copies the contents of one floppy disk to another. N/A diskcopy a: b:

Prepared by Shuvradeb Barman Srijon (iamsrijon)


DISKPART Displays or configures Disk Partition properties. fdisk/parted
DOSKEY Edits command lines, recalls Windows commands, and N/A DOSKEY ls=dir
create marcos.
DRIVERQUERY Displays current device driver status and properties. N/A driverquery
ECHO Displays messages, or turns command echoing on or off. echo echo %SomeVariable%

ENDLOCAL Ends localization of environment changes in a batch file. N/A endlocal

ERASE Deletes one or more files. rm erase <SomeFile>


EXIT Quits the CMD.EXE program (command interpreter). exit
FC Compares two files or sets of files, and displays the diff fc <file1> <file2>
differences between them.
FIND Searches for a text string in a file or files. grep find <SomeToken> <SomeFile>
FOR Runs a specified command for each file in a set of files. for/while/foreach For /f "tokens=2-4 delims=/ " %%a in
('date /T') do (set mydate=%%b-%%a-%%c)
FORMAT Formats a disk for use with Windows. format <drive>: /Q /FS:NTFS
FSUTIL Displays or configures the file system properties. fsutil volume diskfree <SomeDrive>:
FTYPE Displays or modifies file types used in file extension N/A ftype
associations.
GOTO Directs the Windows command interpreter to a labeled goto SomeLabel
line in a batch program.
GPRESULT Displays Group Policy information for machine or user. N/A gpresult /R
GRAFTABL Enables Windows to display an extended character set N/A graftabl
in graphics mode.
HELP Provides Help information for Windows commands. help
ICACLS Display, modify, backup, or restore ACLs for files and chmod and chown icacls <SomeFile> /grant
directories. <SomeUser>:(D,WDAC)
IF Performs conditional processing in batch programs. If IF EXIST filename (
del filename
) ELSE (
echo filename missing.
)

Prepared by Shuvradeb Barman Srijon (iamsrijon)


LABEL Creates, changes, or deletes the volume label of a disk. N/A label <drive_letter>: <drive_label>

MD Creates a directory. mkdir md <directory_name>


MKDIR Creates a directory. mkdir mkdir <directory_name>
MKLINK Creates Symbolic Links and Hard Links ln mklink <link_name> <Target_file>
MORE Displays output one screen at a time. more more <file_name>
MOVE Moves one or more files from one directory to another mv move /Y <SourceFile> <DestPath>
directory.
NET Manipulate a windows service service net start <service_name>
OPENFILES Displays files opened by remote users for a file share. rsync Openfiles /query /s <HostName> /u
<Username> /p <Password>
PATH Displays or sets a search path for executable files. path
PAUSE Suspends processing of a batch file and displays a N/A pause
message.
PRINT Prints a text file. lpr
PROMPT Changes the Windows command prompt. Change the prompt to Cruuent Time:
prompt $T
RECOVER Recovers readable information from a bad or defective recover <drive>:[path]filename
disk.
REM Records comments (remarks) in batch files or # rem some comment
CONFIG.SYS.
REN/RENAME Renames a file or files. mv ren <filename> <new_filename>
REPLACE Replaces files. cp –f replace <SourceFile> <DestPath>
RMDIR/RD Removes a directory. rmdir rd <SomeDirectory>
ROBOCOPY Advanced utility to copy files and directory trees rsync ROBOCOPY \\Computer1\reports
\\Computer2\backup *.doc /S
SET Displays, sets, or removes Windows environment set SET variable=value
variables. echo %variable%
SETLOCAL Begins localization of environment changes in a batch
file.
SC Displays or configures services (background processes). service sc start <SomeService>

SCHTASKS Schedules commands and programs to run on a crontab schtasks /create /sc hourly /st
computer. <StartTime> /tn <TaskName> /tr <AppName>
Prepared by Shuvradeb Barman Srijon (iamsrijon)
SHIFT Shifts the position of replaceable parameters in batch
files.
SHUTDOWN Allows proper local or remote shutdown of machine. shutdown now/init 0 To shutdown: shutdown /s /t 0
To restart: shutdown /r /t 0

SORT Sorts input. sort sort <filename>


START Starts a separate window to run a specified program or start
command.
SUBST Associates a path with a drive letter. mount subst <NewDrive>: <SomeDrivePath>
SYSTEMINFO Displays machine specific properties and configuration. dmidcode systeminfo

TASKLIST Displays all currently running tasks including services. ps -ef tasklist
TASKKILL Kill or stop a running process or application. kill taskkill /ID <process_id>
TIME Displays or sets the system time. date time /T
TITLE Sets the window title for a CMD.EXE session. title <SomeTitle>
TREE Graphically displays the directory structure of a drive or ls -R tree <SomeDir>
path.
TYPE Displays the contents of a text file. cat type <Filename>
VER Displays the Windows version. uname -a ver
VERIFY Tells Windows whether to verify that your files are N/A verify [ON | OFF]
written correctly to a disk.
VOL Displays a disk volume label and serial number. vol_id --uuid vol <somedrive>:
XCOPY Copies files and directory trees. cp -R xcopy <SomeDestDir>
WMIC Displays Windows Management Instrumentation (WMI) N/A It starts a CLI which accept multiple
information inside interactive command shell. commands, for help /?

Prepared by Shuvradeb Barman Srijon (iamsrijon)


Some Useful Code Blocks

To set a variable from user input To go back to the drive root


set /p <SomeVariable>=<PromptText> CD\

To read and print a file line by line To move one level up


FOR /F "tokens=*" %i IN (<FileName>) DO @echo %i CD..

For fast help To remove a Directory and Subdirectory


<SomeCommand> /? RD /S <SomeDirectory>

To create/trunk and write into a file To print special characters ( >, <, | etc )
echo <InputText> > <FileName> Put caret (^) in front of the special character

To append into a file To format a drive to NTFS


echo <InputText> >> <FileName> format <DriveLetter>: /FS:NTFS

To redirect input from file (Ex. to set date from file)


date < <FileThatGotDate>

Prepared by Shuvradeb Barman Srijon (iamsrijon)


To run FTP scripts

ftp -s:<SampleFTPScript> <IPofFTPServer>

Sample FTP Script content

ftpuser
ftppass
SomeFTPCommands

Technique to apply sleep (as there is no sleep command)


ping <SomeInvalidIP> -n 1 -w <TimeInMilliseconds> > nul

To set IP and DNS to Ethernet port (Ex. Interface Name = Local Area Connection)
netsh interface ip set address name="Local Area Connection" static <IPAddress> <SubnetMask> <DefaultGateway>
netsh interface ip set dns "Local Area Connection" static <PrimaryDNS>
netsh interface ip set wins "Local Area Connection" static <SecondaryDNS>

To view IP Configurations
ipconfig /all

To view all entries of ARP table


arp –a

To view Network Connections


netstat

To view routing configurations


route print

To add a persistent route


route add <NetworkAdds> mask <SubnetMask> <GatewayAdds> -p

Prepared by Shuvradeb Barman Srijon (iamsrijon)

You might also like