OOPortal OOPortal


Structured Programming   «Prev 

Using Command Prompt Window

Using a command prompt window (Unix)


A command prompt window in Unix is referred to as a shell window (or terminal window). Here's an example of a Unix shell window.
Screen shot of Unix shell
Screen shot of Unix shell

When you open a shell window the current directory is usually your home directory. For navigating your file system from the shell window you can use the cd, ls, mkdir, and pwd commands. Here's a brief description of each of these commands along with some examples. For more complete information on each of these commands, you can issue the command man followed by the command name.
The cd command The cd command is used to change the current directory.
cd /home/dcrew/progfun changes the current directory to /home/dcrew/progfun
cd .. changes the current directory to the parent directory
cd changes the current directory to the home directory
The mkdir command The mkdir command is used to make a directory.
mkdir progfun makes a subdirectory named progfun in the current directory
The ls command The ls command is used to display the contents of a directory.
ls displays the contents of the current directory
ls home/dcrew/progfun/ displays the contents of the directory named /home/dcrew/progfun
ls progfun displays the contents of the subdirectory named progfun
The pwd command The pwd command is used to display the current directory.
pwd displays the current directory

You might consider printing this Sidebar, as it may come in handy as you work on the exercises in this module.