LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2015, 05:39 PM   #1
emcn.
LQ Newbie
 
Registered: Jan 2015
Posts: 2

Rep: Reputation: Disabled
cd CLI question


Hello all, I am new to Linux (apparently) and am taking a intro course to the OS. My terminal does not support info or man for the cd command and I would like to know: If you won't find the cd command in either /bin or /usr/bin, or in any directory listed in the PATH setting. How is it executed then? (That is, if there is no cd executable, why doesn't this command cause a “command not found” error?)

Thanks for any help!
 
Old 01-31-2015, 06:13 PM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,299

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
cd command

check the man page for your shell (bash I assume). cd = Change Directory is expressed as a shell built-in.

Note: there are some good pages online, and that some advanced behavior is specific to the shell or environment.

For extra credit, consider pushd and popd.
 
1 members found this post helpful.
Old 01-31-2015, 06:13 PM   #3
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Arch & Debian
Posts: 1,183

Rep: Reputation: 283Reputation: 283Reputation: 283
It is a shell builtin.
https://en.wikipedia.org/wiki/Shell_builtin
 
1 members found this post helpful.
Old 01-31-2015, 06:50 PM   #4
emcn.
LQ Newbie
 
Registered: Jan 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for the help
 
Old 01-31-2015, 07:08 PM   #5
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
From man bash

In case you do want to know more about how cd can be used

Quote:
cd [-L|[-P [-e]] [-@]] [dir]
Change the current directory to dir. if dir is not supplied,
the value of the HOME shell variable is the default. Any addi‐
tional arguments following dir are ignored. The variable CDPATH
defines the search path for the directory containing dir: each
directory name in CDPATH is searched for dir. Alternative
directory names in CDPATH are separated by a colon (:). A null
directory name in CDPATH is the same as the current directory,
i.e., ``.''. If dir begins with a slash (/), then CDPATH is not
used. The -P option causes cd to use the physical directory
structure by resolving symbolic links while traversing dir and
before processing instances of .. in dir (see also the -P option
to the set builtin command); the -L option forces symbolic links
to be followed by resolving the link after processing instances
of .. in dir. If .. appears in dir, it is processed by removing
the immediately previous pathname component from dir, back to a
slash or the beginning of dir. If the -e option is supplied
with -P, and the current working directory cannot be success‐
fully determined after a successful directory change, cd will
return an unsuccessful status. On systems that support it, the
-@ option presents the extended attributes associated with a
file as a directory. An argument of - is converted to $OLDPWD
before the directory change is attempted. If a non-empty direc‐
tory 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.
 
Old 02-01-2015, 12:29 PM   #6
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 448

Rep: Reputation: 37
Check out

Code:
man bash-builtins
too
 
Old 02-02-2015, 06:33 AM   #7
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,299

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
PS

If your terminal does not support info or man, use your browser. All of the man and html pages are online in multiple sites.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Very simple CLI question togo59 Linux - Newbie 7 12-14-2009 11:29 AM
A question about downloading at the CLI rookiepaul Linux - General 1 05-08-2006 07:12 AM
CLI and GUI Question desmondlewissmith Linux - Software 1 01-20-2006 03:46 PM
cli:rpm question king_nothingzzz Linux - Software 2 01-16-2004 12:54 AM
CLI question SSA Linux - Newbie 2 01-19-2002 07:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration