cd in Mac OS X

By: Strauss K Emailed: 1704 times Printed: 2205 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Change Directory - change the current working Folder.

Syntax 
      cd [-L|-P] [dir]

Key
   -P   Use the physical directory structure instead of following symbolic links
        (see also the -P option to the set builtin command)

   -L   Force symbolic links to be followed

If a dir is given, changes the shell's working directory to name. If not, changes to HOME.

$ cd - will go back to the last folder you looked at. (Previous directory - equivalent to $OLDPWD)

CDPATH

The shell variable CDPATH provides a useful feature, this variable is similar to PATH but it sets up a list of paths where cd will search for subdirectories. CDPATH may be set on the command line for use in the current session, or in .bash_profile for permanent use, the list of paths must be colon separated (:)

$ CDPATH=".:~:~/Library"

If dir begins with a slash (/), then CDPATH is not used.

If a non-empty directory name from CDPATH is used, or if - is the first argument, and the directory change is successful, the absolute pathname of the new working directory is written to the standard output.

The return value is true if the directory was successfully changed; false otherwise.

Examples

Move to a subfolder named "Documents"
$ cd Documents

move to the fonts folder
$ cd /library/fonts
$ pwd
cd /library/fonts


Change to another folder
$ cd ~/music
$ pwd
/Users/kate/music


Move up to the parent directory (/Users/kate/)
cd ..

To move up two levels:
$ cd ../..

Move to the top of the boot volume
$ cd /

Move to your home directory
$ cd ~

Move to a folder when the folder name includes spaces, parentheses or any other punctuation:
$ cd 'AppleWorks User Data'


macos Home | All macos Tutorials | Latest macos Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Strauss K
cut in Mac OS X
curl in Mac OS X
crontab in Mac OS X
cron in Mac OS X
cp in Mac OS X
continue in Mac OS X
complete in Mac OS X
command in Mac OS X
comm in Mac OS X
cmp in Mac OS X
cksum in Mac OS X
chroot in Mac OS X
chown in Mac OS X
chmod in Mac OS X
chgrp in Mac OS X

More Tutorials in macos
Getting PHP running on Mac OS 10.1
Installing gedit for python programming in Mac OS X
What is Mac OS X?
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X
bless in Mac OS X
break in Mac OS X

More Latest News
Most Viewed Articles (in macos )
apropos in Mac OS X
Different Versions of Mac OS X
cd in Mac OS X
What is Mac OS X?
Major features of Mac OS X
What is new in Mac OS X Snow Leopard
awk in Mac OS X
bg in Mac OS X
builtin in Mac OS X
bzip in Mac OS X
cal, ncal in Mac OS X
cp in Mac OS X
History of Mac OS X
alias, unalias in Mac OS X
basename in Mac OS X
Most Emailed Articles (in macos)
What is Mac OS X?
complete in Mac OS X
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X
bless in Mac OS X
break in Mac OS X
builtin in Mac OS X