Leaving Your Current Working Directory - Red Hat ENTERPRISE LINUX 4 - STEP BY STEP GUIDE Manual

Table of Contents

Advertisement

56
Tip
The interactive, or -i, option for rm causes it to ask if you are sure before permanently deleting a file
or directory. You can make this the default behavior for rm by editing the
located in your home directory. You can edit the file with any text editor.
gedit /home/user/.bashrc
Add the following line somewhere in the file. The end of the file is a good location.
alias rm='rm -i'
Save the file. At the command line, enter the following command.
source .baschrc
Now you will be asked to enter [Y] before deleting a file or directory with
4.5.6. Deleting directories
There are two commands that can be used to delete directories. The first is
.
rm
The
command will only delete directories that are empty. If you are concerned about acciden-
rmdir
tally deleting a directory that is not empty, use this command.
rmdir directory/
The above command permanently deletes
If you want to delete a directory and all of its contents, use the command
enter
, the shell will not ask if you are sure before permanently deleting the directory.
rm -rf
rm -rf /dir1/
The above command deletes

4.6. Leaving your Current Working Directory

To change directories from your current working directory, use the command
cd /tmp/
The above command changes directories to the
line must be a path. It can either be relative or absolute, and can move one directory or many. If
the
command is entered at the shell prompt with no options or path specified, the default action
cd
is to move the user into their home directory. For example, user someone would be moved to the
directory.
/home/someone/
The
has many useful options. You can see all of these options by entering
cd
prompt. The most commonly used options are listed below.
cd — Returns you to your login directory
cd - — Returns you to your previous working directory
directory/
and every file and sub-directory that exists inside.
/dir1/
/tmp/
Chapter 4. Shell Prompt Basics
rm
rmdir
if it is empty.
rm -rf
directory. The second word on the command
file. This file is
.bashrc
and the second is
. Note that if you
.
cd
at the shell
man cd

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 4

Table of Contents