Skip to content

How to create a directory, file, user and soft link in Linux?

Using Linux for the first time can be surprisingly easy if you’re migrating from other operating systems like Windows or even macOS. Over the years Linux has slowly turned into a competent operating system with excellent user interface and a bunch of versions (or flavours as they are called). Each version is different from one another and can be customised to suit your needs.

Linux is so much more than the geeky image people associate it with generally. In this post, we prove this by showing how easy it is to carry out some basic tasks on the Linux terminal.

Also read: 9 reasons why developers tend to choose Linux over Windows

How to create a directory in Linux?

Creating a directory on Linux is a single command task, much like Windows or macOS. To make a new directory, use the following command

mkdir [directory name]

And that’s it. You can take the mkdir command to the next level by making multiple directories at once using the -p flag.

mkdir -p dir1/dir2/dir3

The above command will make a directory tree with dir1 at the top and dir3 at the bottom.

How to create a file in Linux?

I use this all the time. Just like creating directories, creating files is a single command task. Here’s how:

nano filename.extension

Note that there are many ways to create files in Linux. And by many, I mean many. What method you use depends upon what you want the file to contain or its application. However, using nano provides an easy way to create a file and edit it conveniently.

Also read: How to convert HEIC files to JPEG and how to open HEIC on Windows?

How to create a user in Linux?

Depending on how many people use your computer, you might need to create one or more users. Now there’s an effortless way to do it using the settings menu, but for the sake of the article, I’ll be taking the terminal path.

Step 1: Open a terminal and log in as root. Type su and enter the root password.

Step 2: Type in useradd [username] and press enter.

Step 3: Type in passwd [username]. Type in the password for the user you just created.

And you have a new user on your system.

How to create a soft link in Linux?

A soft link or symlink in Linux terms is a special type of file that acts as a reference to another file or directory.

We’ll be using the ln command to create a symlink. Here’s how:

ln -s sorucefile symlinkname

Also read: Linux Gaming: Viable or not?

Hello There!

If you like what you read, please support our publication by sharing it with your friends, family and colleagues. We're an ad-supported publication. So, if you're running an Adblocker, we humbly request you to whitelist us.







>