answersLogoWhite

0


Best Answer

By specifying either the absolute or relative path to file.

Example 1 (absolute path; works from anywhere):

rm /etc/shadow

Example 2 (relative patch; will only work if you are in /usr):

rm ./bin/vi

Example 3 (relative path; removing file from home directory, works from anywhere):

rm ~/mystuff/importantfile

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you remove a file from a directory other than the current one in Unix?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the command that will change the current default directory to the root directory in Unix?

CD /


How does Unix work as a multi-user operating system?

When a user logs in to a Unix system, the current working directory normally starts at the directory/file


Which command would you use to remove a directory on a UNIX server?

rmdir


Every unix directory has at least two hard links why?

The two links are for the current directory (.) and the parent directory (..). This is allow for easy directory traversal.


Can command rmdir can be used to delete a directory that is not empty?

the commandrmdir will not remove a directory if it is not empty in UNIX. The correct way to remove a directory and all its contents recursively is with the rmcommand.


What is the meaning of . and .. in unix?

The '.' refers to the current directory that you are working in, and the '..' refers to its parent (i.e. the directory just above the one you are now in).


What is Topmost directory in unix?

Root directory.


Which commands will give you information about how much disk space each file in the current directory uses in unix?

Use the 'du' command in the directory you are interested in.


What is the Unix command to count the number of files in current directory?

find -type f | wc -l


What command is used to create a suddirectory and change the current directory and to remove a subdirectory?

If for example we wanted to make i subdirictory called foo in Linux or UNIX it you use mkdir foo to change into it you would use CD foo to remove the directory rmdir foo but this will only work if the directory is empty to remove the directory called foo when it is not empty use rm -rf foo but please be sure this is what you really want to do.


What command would you use to remove a directory on a UNIX server?

If you are just removing the directory, use the command: rmdir dir-name The dir-name directory has to be empty for this to work. If there are files or other subdirectories then use the command: rm -rf dir-name


What are five unix commands?

cp - copy a file rm - delete a file mv - rename a file mkdir - create a directory rmdir - remove a directory etc...