Skip to main content

Common Simple Commands

Here are some basic commands useful for managing the filesystem and performing basic tasks:

LinuxWindowsDescription
lsdirLists the contents of a directory -- by default, the current directory, or the directories specified as arguments (or a specific file, if specified).
echoechoPlaces a message on the screen (the message is given as positional arguments)
calDisplays a simple calendar
datedate /t
time /t
Tells you the current date (or date/time)
whoquserDisplays information about the logged in user(s)
whoamiwhoamiDisplays the name of the current user
clearclsClears the screen (terminal). Note: in the Bash shell, you can also clear the screen during command entry by typing Ctrl+L
treetreeDisplays a "tree view" of the filesystem hierarchy starting at the current directory (or the given directory, if an argument is provided).
mkdirmkdirMake a directory/folder
rmdirrmdirRemove a directory/folder
rmdelRemoves/deletes one or more files. Specify ''-rf'' to recursively force delete a directory and its contents on Linux, or ''/s'' to recursively delete a directory and its contents on Windows.
X:(Where X is a drive letter) Switches to the selected drive.
cdcdChanges to the given directory, if one is given. If no directory is given, displays the current directory (Windows) or changes to your home directory (Linux). On Windows, a drive designator may be provided, in which case the current directory will be set on the indicated drive.
pwdcdPrints the current working directory.
cpcopyCopy one or more files to a new name/location.
mvmoveMoves a file from one directory to another.
mvren
rename
Renames a file (on Linux, the filename and location are considered to be the same thing)
cattypeDumps the contents of a text file on the terminal (if there is a lot of text, the display will scroll; if the file is a non-text file, the results are undefined!)
more
less
moreDisplays a file one screen at a time. (Linux: the less command is a more powerful version of the ''more'' command, which allows things like scrolling backwards)
cutSelects specific columns from a text file
sortsortSorts a text file
diffcomp
fc
Shows the differences between (text) files
uniqDisplays identical consequtive lines only once
trTranslates/replaces/deletes occurrences of characters
grepfindSearches files for text
findSearches for files
touchcopy NUL: //filename//Creates an empty file (Linux: if the file exists, ''touch'' will just update the date/time of modification).