[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMarch 17, 2023

How to use Unlink Command.

How To Use Unlink Command.

In this article, we will show you how to remove a file in GNU/Linux systems using the unlink command.

 

unlink is a command-line utility for removing a single file.

The syntax of the unlink command is as follows:

unlink filename

Where filename is the name of the file you want to remove. On success, the command doesn’t produce any output and returns zero.

The unlink command accepts only two options, –help which displays the command help and –version which shows the version information.

Be extra cautious when removing files using the unlink command, because once the file is deleted, it cannot be fully recovered.

Unlike the more powerful rm command, unlink can accept only a single argument which means that you can delete only one file. If you try to remove more than one file, you will get “unlink: extra operand” error.

When removing symbolic links with unlink, the file the symlink points to is not removed.

To remove a given file, you need to have writing permissions on the directory containing that file. Otherwise, you will get “Operation not permitted” error.

For example, if you try to remove the file file3.txt under the /opt directory which is owned by root:

unlink /opt/file2.txt

The system will print the following message:

unlink: cannot unlink '/opt/file2.txt': Permission denied

On GNU/Linux systems unlink can never delete a directory . If you try to remove a directory:

unlink dir1

You will get the following message:

unlink: cannot unlink 'dir1': Is a directory

 

Conclusion

Removing files with unlink is a simple process, but you must be careful not to delete relevant data.

Keep reading
How to create users with usseradd comand.
June 28, 2023

How to create users with usseradd comand.

How To Create Users With Usseradd Comand. In this article, we will talk about how to create new user accounts using the useradd command. useradd Command The general syntax for the useradd command is as follows: useradd [OPTIONS] liviu.daniel .daniel You can add users only if you have sudo…

Read article
How to use time command.
June 27, 2023

How to use time command.

How To Use Time Command. In this article we will show you how to use time command. For example, if you have two different scripts doing the same job and you want to know which one performs better you can use the Linux time command to determine the duration of execution of each script.…

Read article
How to Rename Files and Directories.
June 26, 2023

How to Rename Files and Directories.

How To Rename Files And Directories. In this tutorial, we will show you how to use the mv and rename commands to rename files and directories. Renaming Files with the mv Command The mv command (short of move) is used to rename or move files from one location to another. The syntax for the…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00