Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 20th, 2008, 05:37 AM
Darren Taylor Darren Taylor is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 20 Darren Taylor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 23 sec
Reputation Power: 0
Making Directories

I have a simple question;

Let's assume I'm somewhere other than the home directory using the command line, for example, I've navigated to /home/documents/exam/revision

Is there anyway, from the current location, to create a new directory or file into any the preceding directories, for example, creating a directory called pipes in the home directory.

Or can you only do so by changing to the directory and issuing the mkdir command?

Thanks in advance!

Reply With Quote
  #2  
Old April 20th, 2008, 08:19 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 548 L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 20 h 21 m 37 sec
Reputation Power: 42
Send a message via AIM to L7Sqr
you can use relative (from where you are) or absolute (the fully qualified name) path from anywhere on the system.
~/ indicates your home directory, so if your username was jpaul and your home directory was /home/jpaul, then
Code:
mkdir ~/new_dir
would create /home/jpaul/new_dir from anywhere in teh system.
../ refers to the directory directly above the one you are at. So if you are in /usr/bin/someplace and you do
Code:
mkdir ../../share/new_dir
then you will have created the directory /usr/share/new_dir
./ refers to the current working directory and is usually not of much use in typing in path names.

Realize that you must have permissions to create these directories or they will not be created. Also, to make things easier, you can set up an environment variable to represent a commonly used path. Say, for example you always put files in a location /home/jpaul/backups/current/ but you copy files there from all over the system, then you can create an environment variable called BKUP (in bash you would do export BKUP=/home/jpaul/backups/current/ or edit your .bashrc) then you could (from anywhere) do
Code:
cp files $BKUP
__________________
-- I'll provide you with reference points; if they dont work, refer to something else.

While I've regularly been provided 'working' software that fails to build or work as advertised I've yet to face a Copyright/Warranty/License that isnt exact to the finest detail. Priorities, my friend. Priorities.

Reply With Quote
  #3  
Old April 20th, 2008, 08:56 AM
Darren Taylor Darren Taylor is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 20 Darren Taylor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 23 sec
Reputation Power: 0
Thanks alot!

So... if i was in home/dtaylor/dir1/dir2/dir3

And i wished to create a directory called subdir1 in dir1, I could do the following:

mkdir ~/dtaylor/dir1/subdir1

or

mkdir ../../subdir1 ?

I know I should be testing this for myself, but I don't have Linux at home for the time being.

Reply With Quote
  #4  
Old April 20th, 2008, 09:33 PM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 548 L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 20 h 21 m 37 sec
Reputation Power: 42
Send a message via AIM to L7Sqr
Quote:
mkdir ~/dtaylor/dir1/subdir1

Should be
Code:
mkdir ~/dir1/subdir1

Other than that, yes.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Making Directories


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway