How to create files and folders in the terminal : a brief overview of some basic Linux commands


The Linux family of operating systems, while small, are a nonetheless important and integral part of the IT industry. In the IT industry you’ll find Linux systems in use, particularly working as Servers. 


 As IT professionals it is our responsibility to learn as much as we can about different technologies to facilitate and provide support to both customers and co-workers. The Linux terminal and file system can seem daunting at first. This guide serves to acquaint the worker with a look at some basic terminal commands as well as the naming conventions that differ from windows. We will then create some simple folder structures in the terminal. This is especially useful for Linux distributions that don’t use a GUI as all commands must be done in the Terminal. 


For the purpose of this guide, I will be using one of the more popular versions of Linux, Ubuntu Desktop (latest version 20.04.20 LTS). Although there are seemingly hundreds if not thousands of different Linux distributions, they all share the same command line structure and functions. 


Accessing the Terminal 

On Ubuntu, the terminal can be accessed by going to the search function and typing the start of the words “Terminal”, “Shell”, “Command”, or “Prompt”. The search function on Ubuntu is accessed by left clicking on “Activities” in the top-left corner of the screen. 

Finding terminal 

Alternatively, the terminal can be brought up with the shortcut Ctrl-Alt-T


Basic Commands 

  1. pwd – Print Working Directory 

The pwd lets us know where we are. It prints out the exact file path or folder for the directory that we are in. 

pwd command 

  1. ls – List 

The ls command is the Linux equivalent of the ‘dir’ function in Windows. It lists the contents of your current command 

  1. cd – Change Directory 

The cd command is used to move around changing directories. The ~/ key is shorthand for the local user. For example, to move to the local user’s Downloads folder, type “~/Downloads”.  

cd command 

The blue colouring means that we are now in this directory.  

You can also press TAB while typing to autocomplete some words and commands. 

  1. clear – Clears our terminal screen 

This one is self-explanatory, but nonetheless good for when you need to focus or start fresh. 

  1. mkdir <folder name> – Make a new directory (folder). 

  1. touch <file name> – Creates a new file. 

  1. xdg-open <file or folder name> – Open a file or folder in a relevant application. 


Let’s combine these basic commands to create some folders on the desktop and create a text document inside them. I want to make a folder on the desktop, two folders in that folder, and one text document in one of the folders. 

  1. Open up a fresh terminal and type “cd ~/Desktop” to go to the Desktop. 

  1. Type “mkdir TestFolder1” or whatever you would like to name your folder. 

  1. Type “cd TestFolder1” to enter that folder. 

  1. On two separate lines, type “mkdir TestFolder2” and “mkdir TestFolder3” 

  1. Type “cd TestFolder2” and then “touch TestFile.txt” to create a text file inside TestFolder2. 

  1. Type “xdg-open TestFile.txt” to open the file.  

mkdir commands 


Other Useful Commands 


ls -l – List file permissions for users. 

df -m – See available space of different partitions on disk (in megabytes) 

cp – Copy files in the terminal. This command requires a destination.  

mv – Similar to cp, mv simply moves file rather than creating a copy. 

Example to copy our test file to the Desktop: 

cp command 

locate – Helps us locate specific files. This command needs to be installed, which brings up one of the coolest features of Linux.sudo apt install command 

Linux is fully customizable allowing Operating Systems to be as complex or as simple as desired. When I tried to use the locate command, it wasn’t installed on my copy of Ubuntu. We can install an ‘apt’ (linux version of an .exe) straight through the command line. ‘sudo’ means ‘super user do’ and is the Linux equivalent of running a program as an Administrator and require password authentication. 


After installing the locate command, we can now run “locate TestFolder” again and voila! 

locate command 


This is very basic and there are thousands more Linux that can be ran. There are dozens of websites that list basic intermediate and complex terminal commands as well as online videos and an active community of users.  


Welcome to Linux! 

Tags: Linux, Terminal
Last update:
25-03-2021 01:20
Simon Kelly
Average rating: 5 (3 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category


Sticky FAQs