488889
209
Zoom out
Zoom in
Previous page
1/284
Next page
17.3.1 Examples for Working with Files and Directories
Suppose you want to copy a le located somewhere in your home directory to a
subdirectory of /tmp that you need to create rst.
Procedure 17.1: Creating and Changing Directories
From your home directory create a subdirectory in /tmp:
1 Enter
mkdir /tmp/test
mkdir stands for “make directory”. This command creates a new directory
named test in the /tmp directory. In this case, you are using an absolute path
to create the test directory.
2 To check what happened, now enter
ls -l /tmp
The new directory test should appear in the list of contents of the /tmp direc-
tory.
3 Switch to the newly created directory with
cd /tmp/test
Procedure 17.2: Creating and Copying Files
Now create a new le in a subdirectory of your home directory and copy it to /tmp/
test. Use a relative path for this task.
IMPORTANT: Overwriting of Existing Files
Before copying, moving or renaming a le, check if your target directory already
contains a le with the same name. If yes, consider changing one of the lenames
or use cp or mv with options like -i, which will prompt before overwriting an ex-
isting le. Otherwise Bash will overwrite the existing le without conrmation.
1 To list the contents of your home directory, enter
ls -l ~
It should contain a subdirectory called Documents by default. If not, create this
subdirectory with the mkdir command you already know:
mkdir ~/Documents
2
To create a new, empty le named myfile.txt in the Documents directory,
enter
Shell Basics 197
209


Need help? Post your question in this forum.

Forumrules


Report abuse

Libble takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Product:

For example, Anti-Semitic content, racist content, or material that could result in a violent physical act.

For example, a credit card number, a personal identification number, or an unlisted home address. Note that email addresses and full names are not considered private information.

Forumrules

To achieve meaningful questions, we apply the following rules:

Register

Register getting emails for Suse openSUSE 12.2 at:


You will receive an email to register for one or both of the options.


Get your user manual by e-mail

Enter your email address to receive the manual of Suse openSUSE 12.2 in the language / languages: English as an attachment in your email.

The manual is 14 mb in size.

 

You will receive the manual in your email within minutes. If you have not received an email, then probably have entered the wrong email address or your mailbox is too full. In addition, it may be that your ISP may have a maximum size for emails to receive.

Others manual(s) of Suse openSUSE 12.2

Suse openSUSE 12.2 User Manual - English - 530 pages


The manual is sent by email. Check your email

If you have not received an email with the manual within fifteen minutes, it may be that you have a entered a wrong email address or that your ISP has set a maximum size to receive email that is smaller than the size of the manual.

The email address you have provided is not correct.

Please check the email address and correct it.

Your question is posted on this page

Would you like to receive an email when new answers and questions are posted? Please enter your email address.



Info