Difference between revisions of "CLI Navigating"

From FreekiWiki
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
  This class is not currently offered. [[User:Laurel|Laurel]] 21:42, 31 July 2010 (UTC)
 +
 
== Introduction ==
 
== Introduction ==
 
Navigating, or moving around, is essential to command line mastery. When you login you'll start in your home directory, /home/<your-user-name> and for whatever reason you might want to change into a different directory. This page will show you the basics of CLI navigation and present you with some questions to help you learn how to get around better.
 
Navigating, or moving around, is essential to command line mastery. When you login you'll start in your home directory, /home/<your-user-name> and for whatever reason you might want to change into a different directory. This page will show you the basics of CLI navigation and present you with some questions to help you learn how to get around better.
Line 52: Line 54:
 
# How would you confirm where you are?
 
# How would you confirm where you are?
 
# How would you list the contents of your parent directory?
 
# How would you list the contents of your parent directory?
# Show a relative path that starts in your home directory and specifies the /etc/init.d/ directory.
+
# Show a relative path that starts in your home directory and specifies the /var/log/ directory.
 +
# If you were in the / directory how would you change to the /home/rwlove directory with a path that starts in your home directory?
  
 
== Instructor Notes ==
 
== Instructor Notes ==

Latest revision as of 14:42, 31 July 2010

 This class is not currently offered. Laurel 21:42, 31 July 2010 (UTC)

Introduction

Navigating, or moving around, is essential to command line mastery. When you login you'll start in your home directory, /home/<your-user-name> and for whatever reason you might want to change into a different directory. This page will show you the basics of CLI navigation and present you with some questions to help you learn how to get around better.

Commands

cd  = change directory
ls  = list directory contents
pwd = print the working directory

Abbreviations

/  = the root directory
.. = the parent directory
~  = your home directory
-  = the last directory you were in (not used in paths)

Examples

Example 1

Change to the /usr/local/bin directory, using an absolute path.

cd /usr/local/bin/

Example 2

Change to the /etc/init.d/ directory, using a relative path (assuming you're in your home directory)

cd ../../etc/init.d/

Example 3

Change to your home directory, using an absolute path.

cd /home/<your-user-name>

Example 4

Change to the /home/rwlove directory.

cd /home/rwlove

Change to the / directory.

cd /

Change back to the last directory you were in.

cd -

Change to the last directory you were in.

cd -

Quiz

  1. How would you change to the root directory?
  2. How would you change to the Desktop directory within your home directory?
  3. How would you change back to your home directory?
  4. How would you confirm where you are?
  5. How would you list the contents of your parent directory?
  6. Show a relative path that starts in your home directory and specifies the /var/log/ directory.
  7. If you were in the / directory how would you change to the /home/rwlove directory with a path that starts in your home directory?

Instructor Notes

This class needs a better introduction paragraph and a few more quiz questions.