DOS Commands: Command and Usage Examples
DOS Commands: Command and Usage Examples
C: C:
Go to the C: drive. Similarly A: and D: etc.
CLS CLS
Clear the screen.
You can use the * and the ? wildcards to search for DIR /W displays the files/folders in multiple
a particular file. The ? character represents ONE rows. This view gives less information per file.
character, and the * character represents multiple
characters. DIR *.JPG displays all files with the extension
JPG in the current directory and all
DIR *.* lists all the files in a directory. subdirectories.
RD RD <DIRECTORYNAME>
Remove directory. Removes a sub-directory of the
current directory. The directory you want to remove
must be empty of all files. (The command can also
be written as RMDIR)
UINX COMMANDS
Key/Command Description
cd Home directory
cd ~ Home directory
cd / Root of drive
cd - Previous directory
ls Short listing
ls -l Long listing
[command] > [file] Push output to file, keep in mind it will get overwritten
[command] >>
Append output to existing file
[file]
Linux Commands
pwd It gives us the Absolute Path, which means the path that starts from
the root.
ls The “Is” command is used to know what files are there in the directory
you are in. You can see all the hidden files by using the command “ls -
a”.
cd “cd” is the command used to go to a directory.
mkdir & rmdir The mkdir command is used when you need to create a folder or a
directory.
rmdir is the command used for deleting a directory. To delete a
directory containing files, rm is used.
rm The rm command is used to delete files and directories. rm cannot
simply delete a directory. “rm -r” is used to delete a directory. In this
case, it deletes both the folder and the files in it.
touch The touch command is used to create a file. It can be anything, from
an empty txt file to an empty zip file.
man & –help To know more about a command and on how to use it,
the man command is used. It shows the manual pages of the
command.
cp The cp command is used to copy files through the command line. It
takes two arguments, the first one is location of the file to be copied,
the second iswhere to copy.
mv The mv command is used to move files through the command line.
We can also use the mv command to rename a file.
locate The locate command is used to locate a file in a Linux System, just
like the search command in Windows.