FACTOID # 108: Japan leads the world in car production, producing almost 50% more cars than either of its next closest competitors, Germany and the United StatesInteresting industry facts »
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Chdir


cd, sometimes also available as chdir (change directory), is a command line command to change the current working directory in operating systems such as Unix, Windows and DOS. It is also available for use in Unix shell scripts and in batch files on Windows or DOS. CHDIR() is also a Visual Basic function which changes the working directory. This article or section does not adequately cite its references or sources. ... For computer operating systems that support a hierarchial file system, the working directory is the directory path that a user or program has designated to be the directory for files referenced by name only, or by a relative path (as contrasted with using both a files name and a... // An operating system (OS) is a set of computer programs that manage the hardware and software resources of a computer. ... Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ... Microsoft Windows is the name of several families of proprietary software operating systems by Microsoft. ... Instructions on how to use the directory command. ... A shell script is a script written for the shell, or command line interpreter, of an operating system. ... Wikibooks has more about this subject: Guide to Windows commands In MS-DOS, OS/2 and Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. ... Visual Basic (VB) is an event driven programming language and associated development environment from Microsoft for its COM programming model. ...


Usage

A directory is a logical section of a filesystem used to hold files. Directories may also contain other directories. The cd command can be used to change into a subdirectory, move back into the parent directory, move all the way back to the root (/ in UNIX, in DOS) or move to any given directory. In computing, a directory, catalog, or folder, is an entity in a file system which can contain a group of files and/or other directories. ... It has been suggested that Crash counting be merged into this article or section. ...


Consider the following subsection of a Unix filesystem, which shows a user's home directory (represented as "~") with a file ("text.txt") and three subdirectories.

A user's view of the file system in Unix-like systems begins with the home directory (often abbreviated to ~). From there, the tree can spread into more subdirectories and/or files.
A user's view of the file system in Unix-like systems begins with the home directory (often abbreviated to ~). From there, the tree can spread into more subdirectories and/or files.


Wikipedia does not have an article with this exact name. ...


If the user's current working directory is the home directory ("~"), then entering the command "ls" followed by "cd games" might produce the following transcript:

 me@host:~$ ls workreports games encyclopedia text.txt me@host:~$ cd games me@host:games$ 

The user is now in the "games" directory. LS may refer to: .ls, the Internet top-level domain for Lesotho Jet2. ...


A similar session in DOS (though the concept of a "home directory" may not apply, depending on the specific version) would look like this:

 C:> dir workreports <DIR> Wed Oct 9th 9:01 games <DIR> Tue Oct 8th 14:32 encyclopedia <DIR> Mon Oct 1st 10:05 text txt 1903 Thu Oct10th 12:43 C:> cd games C:games> 

Note that cd has different effects on different operating systems if given with no arguments. For example, if executed without arguments in DOS, the current working directory is printed. If executed without arguments in Unix, then the user is returned to the home directory. The effect of executing the cd command within a script or batch file also varies. In DOS, the caller's current directory can be directly altered by the batch file's use of this command. In Unix the caller's current directory is not altered by the script's invocation of the cd command. This is because in Unix, the script is usually executed within a subshell. In computer software, specifically the command line interface (CLI) of the DOS operating system, dir is a command used for file and directory listing. ... For computer operating systems that support a hierarchial file system, the working directory is the directory path that a user or program has designated to be the directory for files referenced by name only, or by a relative path (as contrasted with using both a files name and a...


How it works

cd is frequently included built directly into the command line interpreter. This is the case in most of the Unix shells (Bourne shell, tcsh, bash, etc.), cmd.exe and Windows PowerShell on Windows and COMMAND.COM on DOS. It has been suggested that this article or section be merged into Command line interface. ... Screenshot of a sample Bash session, taken on Gentoo Linux. ... The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. ... tcsh is a Unix shell based on and compatible with the C shell (csh). ... This article is about the Unix shell. ... For other uses of cmd, see CMD. cmd. ... Windows PowerShell, previously Microsoft Shell or MSH (codenamed Monad) is an extensible command line interface (CLI) shell and scripting language product developed by Microsoft. ... COMMAND.COM is the name for the default operating system shell (or command line interpreter) for DOS and 16/32bits versions of Windows (95/98/98 SE/Me). ...


Command line shells on Windows usually use the Windows API to change the current working directory, whereas on Unix systems cd calls the chdir() POSIX C function. This means that when the command is executed, no new process is created to migrate to the other directory as is the case with other commands such as ls. Instead, the shell itself executes this command. This is because, when a new process is created, child process inherits the directory in which the parent process was created. If the cd command inherits the parent process' directory, then the objective of the command cd will never be achieved. The Windows API, informally WinAPI, is the name given by Microsoft to the core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. ... POSIX or Portable Operating System Interface[1] is the collective name of a family of related standards specified by the IEEE to define the application programming interface (API) for software compatible with variants of the Unix operating system. ... C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... LS may refer to: .ls, the Internet top-level domain for Lesotho Jet2. ... Illustration of a physical process: a geyser in action. Process (lat. ... A child process is a computer process created by another process (the parent process). ... A parent process is a computer process that has created one or more child processes. ...


Windows PowerShell, Microsoft's new object-oriented command line shell and scripting language executes the cd command (cmdlet) within the shell's process. However, since PowerShell is based on the .NET Framework and has a different architecture than previous shells, all of PowerShell's cmdlets like ls, rm etc. run in the shell's process. Of course, this is not true for legacy commands which still run in a separate process. Object-oriented programming (OOP) is a programming paradigm that uses objects to design applications and computer programs. ... Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard. ... The Microsoft . ... LS may refer to: .ls, the Internet top-level domain for Lesotho Jet2. ... RM may mean: Real Madrid, a Spanish football (soccer) club Marshall Islands: FIPS PUB 10-4 territory code R. Madhavan Ranch to Market Road, a type of secondary state highway in Texas Random map (a randomly generated map in strategy games) Rapid manufacturing, the use of computer automated additive manufacturing...


See also


  Results from FactBites:
 
Bug ID: 4045688 Add chdir or equivalent notion of changing working directory (4750 words)
ChDir is quite a hack for currently running process, so I would like to vote against.
There are times when being able to do a chdir() would be nice, and they are when integrating with particularly crufty pieces of native code.
Introducing an API method called chdir() that does *not* do so is dangerously misleading, since this piece of process state is externally visible on most operating systems.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m