Hdi2u S10

From wiki
Jump to: navigation, search

Changing directories

  • Directories are the same as folders. In linux "directory" is more common.
  • Directories within directories are called subdirectories"
  • The command used to change directories is cd
  • Think of your directory structure, (i.e. this set of nested file folders you are in), as a tree structure
  • The simplest directory change you can do is move into a directory directly above or below the one you are in.

Exercises

  • To change directory to the one above your are in, use the shortcut symbol learnt above
cd ..
  • To returns to the last directory you were working in before this one.
cd –

To change to a directory one below you are in, just use the cd command followed by the subdirectory name:

cd subdir_name
  • If you need to change directory without worrying where you are now, you could explicitly state the full or absolute path:
cd /usr/local/bin
  • If you wish to return to your home directory at any time, just type cd by itself.
cd
  • Type
cd utr
  • Type it again. Why doesn't this work?
  • Change directory into the /usr/bin directory by typing
cd /usr/bin
  • List the files in this directory. This is the main directory of runnable programs on the system.
  • How can you get back to your home directory from here?