0% found this document useful (0 votes)
38 views1 page

Using mkdir to Create Directories

The document discusses creating folders and files in Linux. It instructs the user to create a new "/tmp/tutorial" directory to experiment in without affecting their real files. Inside this new directory, it creates subdirectories called "dir1", "dir2", and "dir3" using the "mkdir" command. It then lists the contents of the current directory using the "ls" command to view the newly created subdirectories.

Uploaded by

sandeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Using mkdir to Create Directories

The document discusses creating folders and files in Linux. It instructs the user to create a new "/tmp/tutorial" directory to experiment in without affecting their real files. Inside this new directory, it creates subdirectories called "dir1", "dir2", and "dir3" using the "mkdir" command. It then lists the contents of the current directory using the "ls" command to view the newly created subdirectories.

Uploaded by

sandeep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Creating folders and files

In this section we’re going to create some real files to work with. To avoid accidentally
trampling over any of your real files, we’re going to start by creating a new directory, well
away from your home folder, which will serve as a safer environment in which to
experiment:
mkdir /tmp/tutorial
cd /tmp/tutorial
Notice the use of an absolute path, to make sure that we create the tutorial directory
inside /tmp. Without the forward slash at the start the mkdir command would try to find
a tmp directory inside the current working directory, then try to create a tutorial directory
inside that. If it couldn’t find a tmp directory the command would fail.
In case you hadn’t guessed, mkdir is short for ‘make directory’. Now that we’re safely inside
our test area (double check with pwd if you’re not certain), let’s create a few subdirectories:
mkdir dir1 dir2 dir3
There’s something a little different about that command. So far we’ve only seen commands
that work on their own (cd, pwd) or that have a single item afterwards (cd /, cd
~/Desktop). But this time we’ve added three things after the mkdir command. Those things
are referred to as parameters or arguments, and different commands can accept different
numbers of arguments. The mkdir command expects at least one argument, whereas
the cd command can work with zero or one, but no more. See what happens when you try to
pass the wrong number of parameters to a command:
mkdir
cd /etc ~/Desktop
Back to our new directories. The command above will have created three new subdirectories
inside our folder. Let’s take a look at them with the ls (list) command:
ls

You might also like