Chapter 13. Navigating the File System

In This chapter:

  • Moving Around

  • Working in Multiple Locations

  • Letting the Shell Find Directories for You

  • Using Aliases and Variables To Move Around

Your home directory is your initial location when you log in, but you'll probably work at other locations as well. You should make a practice of moving to the directory that contains the files you want to work on. This chapter discusses the capabilities that the shell provides for traveling quickly and easily through the file system:

  • Basic commands for moving around the file system

  • The directory stack (what it is, how it helps you, and how to use it)

  • Using aliases and variables to make changing directories an easy task

As you become more adept at moving around, you may notice how easy it is to forget where you are. Chapter 14, Keeping Track of Where You Are, discusses how to avoid "getting lost" in the file system.

Moving Around

The primary command for changing your location in the file system is cd (change directory), which can move you into any directory for which you have permission. In order to use cd effectively, you should learn the basic idioms:

% cd                          Move to your home directory
% cd ..                       Move up to parent of current directory
% cd dirl                     Move to dir1 under current directory
% cd dirl/dir2/dir3           Move to directory several levels below current directory
% cd /                        Move to root directory
% cd /dirl                    Move to dir1 under root directory
% cd /dirl/dir2/dir3          Move to directory several levels below root directory

Convenient ...

Get Using csh & tcsh 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.