|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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 ../ 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 ./ 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. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Quote:
Should be Code:
mkdir ~/dir1/subdir1 Other than that, yes. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Making Directories |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|