Working with Directories

CommandSyntax (Example)Description
cdcd [path]Changes directory to the specified path.
 cd ..Changes to the parent directory of the current directory.
 cd -Changes to the previous working directory, prior to the last cd command.
 cdChanges to the home directory of the current login ID.
 cd ~Changes to the home directory of the current login ID.
dir See the ls command.
lsls [path]Lists the contents of a directory.
 ls -l (ll)Lists the files in long format, displaying all file attributes.
 ls -aLists all files (including hidden files, sometimes referred to as dot files).
mkdirmkdir <directory>Makes a new directory.
pwd Displays present working directory.
rmdirrmdir <directory>Removes a directory.

Get Special Edition Using Linux®, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.