RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

In what directory will the command cd .. not do anything at all?

Question:

In what directory will the command 'cd ..' (note the two dots in this command) not do anything at all?

Answer:

In root directory "/".

Since the .. directory points to a parent directory and / ( root directory ) is on the top of the file system hierarchy standard and therefore it does not have a parent directory, the "cd .." command will not do anything at all. We may also say that / directory is a parent directory of itself. Try:

$ cd /
$ pwd
/
$ cd ..
$ pwd
/

Long Answer:

Every directory in the linux file system contains two special directories and they are:

  • "." a current working directory
  • ".." a parent directory

To see these special directories enter command:

ls -a

Current working directory "." points to itself.

Examples:

The command below will copy a file from /tmp directory to a current working directory:

cp /tmp/file .

Ore check disk space mounted below my current working directory:

df -h .

Parent directory ".." points to a directory one above my current working directory.

Examples:

Use a symbolic path to navigate to different directory in the same parent directory:

$ pwd
/tmp
$ cd ../etc/
$ pwd
/etc

Navigate two directories above my current directory:

$ pwd
/etc/terminfo
$ cd ../..
$ pwd
/

Linux questions and answers

Share this linux post:

Submit In what directory will the command cd .. not do anything at all? in Delicious Submit In what directory will the command cd .. not do anything at all? in Digg Submit In what directory will the command cd .. not do anything at all? in FaceBook Submit In what directory will the command cd .. not do anything at all? in Google Bookmarks Submit In what directory will the command cd .. not do anything at all? in Stumbleupon Submit In what directory will the command cd .. not do anything at all? in Technorati Submit In what directory will the command cd .. not do anything at all? in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download