pavement

Cd

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(Add how to go to an user's directory)
(cd is a built-in)
Line 1: Line 1:
Under FreeBSD and other unixlike OSes, '''cd''' means just what it does under Windows - "change directory."  
+
Under FreeBSD and other unixlike OSes, '''cd''' means just what it does under Windows - "change directory." The ''cd'' command is built into any version of the Unix [[shell]] that you are likely to find.
  
 
The notable differences being that under unixlike OSes a space is required between '''cd''' and the name of the directory to change to and a forward slash '''/''' is used instead of a backward slash '''\'''
 
The notable differences being that under unixlike OSes a space is required between '''cd''' and the name of the directory to change to and a forward slash '''/''' is used instead of a backward slash '''\'''

Revision as of 14:30, 12 June 2006

Under FreeBSD and other unixlike OSes, cd means just what it does under Windows - "change directory." The cd command is built into any version of the Unix shell that you are likely to find.

The notable differences being that under unixlike OSes a space is required between cd and the name of the directory to change to and a forward slash / is used instead of a backward slash \

C:\Windows> cd\stuff (windows)
splat# cd /stuff     (unixlike)
C:\Windows> cd..     (windows)
splat# cd ..         (unixlike)

cd by itself will send you to your home directory, as will cd ~. cd - will show you and then change your directory to the last directory you were in, as below:

[dave]@deus /var/log % cd ~
[dave]@deus ~ % pwd
/home/dave
[dave]@deus ~ % cd /etc
[dave]@deus /etc % cd -
/home/dave
[dave]@deus ~ %

Common Arguments

.. up one level, e.g., cd .. in /e/foo will take you to /e/
- previous directory
~ home
~username home directory of the user "username"
. the directory I am in. Not used very often with cd but more often with commands.
Personal tools