Categories: Hostripples Featured

Introductory Linux Commands

As the title suggests, in this tutorial we are going to discuss the Introductory or the Basic commands in Linux. These commands are for beginners who want to learn Linux and how to use commands on the terminal. These commands can be used on almost all the Linux Distributions.

Let’s have a brief overview of Linux:

What is Linux?

Linux is a powerful, Open Source Operating System specially designed for server systems. 90% of the world’s fastest computers run on some form of Linux, it is because of the rock solid system of Linux. It is developed by a Linus Travold in 1991.
Linux and Unix are different. Linux comes in many different varieties which are called Distributions. For Ex: Ubuntu, Fedora, Mint, Debian, and Android.

Let’s learn these commands and how they can be used.

1. ls:- This command is used for listing all the files and folders which are present on the current path without hidden files and folders. In other words, we can say that it lists the contents of the current working directory. It is similar to the Dir command in Windows.
Following command lists all the files and folders which are present under “Ava” directory.
Options :
? ls – a: It will list all the directory contents along with hidden files and folders that are there in that particular directory. Hidden files and folders are those who have a dot (.) prefix to their names.
? ls – l: It lists the directory contents along with the permissions, ownership, size, date and time stamp without hidden files. The permissions are: Read, Write and Execute.

? ls – al: It lists the directory contents in a long list format that is with permissions, ownership, size, date and time stamp along with the hidden files and folders.

2. ll: It shows the list of the current working directory in a long listing format with permissions, ownership, size, date and time stamp without hidden files.

Option:
? ll – a: This command displays directory contents in long list format but with hidden files and folders.

3. cd: It stands for Change Directory. This command has a lot of variations. It is used for navigations from current to a previous directory as well as previous to the current directory. It is similar to the windows CD command. It will move you to the particular directory.
We are currently in the “root” directory. Suppose we want to navigate to or change our directory to “Ashton” directory and list its contents then we will give following commands.

Options:
? cd ~: This command will navigate you directly to the root directory.
Here we can see that previously we were inside “Ashton” directory, so by using cd ~ command, we can directly move to the root directory.

? cd ..: This command is used for navigating to the parent directory from the current directory.
In the following example initially we were in a root directory, for that, I have used pwd command. Then I have used ls command for displaying the directory contents and if I want to see the directory contents of ” Ryan” I will move to “Ryan” using cd command and then I have used ls command. Now if again we want to move to the root directory then I will use cd .. command as follows:

4. pwd: It stands for Print Working Directory. It will print the current working directory i.e. it will show you in which directory you are currently located at.
In the previous example, we moved to the root directory from “Ryan”. So in this output, it is showing that we are currently located in a root directory.

5. move: This command has 2 uses. It is used for renaming a file and also for moving between the directories.
? How to rename a file or folder:
In the following example, initially we were in “Sean” directory and under it, I have a file named “Adam”. Suppose I want to rename that file as “Jefferson” then I will use move command in the following way:
Syntax: # mv [old file name] [New file Name]

? How to move a file from one directory to another:
Another use of move command is moving a file from one path to another or moving a directory from one path to another. In the following example, I have moved a file “Harmony” which was under Ryan Directory to the “Stella” directory.

? How to move a directory:
We can move a directory from one path to another. Here I have shown how to move “Ashton” directory which was initially under “Root” directory to the “Ryan” directory. Here you can see that the “Ashton” directory has been moved to “Ryan”

6. man: It stands for Manual. It is an interface to the on-line reference manuals. man is the system’s manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections, following a pre-defined order and to show only the first page found, even if a page exists in several sections.
In the following example, I have used man command with ls. This command will provide a detailed information regarding ls command, like Name, Synopsis, Description, and list of mandatory arguments.
In a similar way, man command provides above details for each specific argument.

The output will be as follows:

7. mkdir: As the name specifies, mkdir stands for make directory. This command is used for creating a new directory.
I wanted to create a new directory “Martin” under “Ryan”. Martin directory is listed in the directory contents of “Ryan”.

8. rmdir: It stands for remove directory. Whenever you want to delete any directory rmdir command is used.
Note: If the directory is not empty then you cannot remove it.
In the following example, I have removed the “Kevin” Directory.

In this screen, you can see that Ryan directory has been removed.


? When your directory is not empty then at that time of executing rmdir command, it will throw an error message: “Directory not empty”.
? Following screen shows the error message as the directory “Braxton” which I was trying to remove is not empty.

9. rm: This command is used for removing a file. I wanted to remove “Tanvir” file under Ryan Directory. When I gave the remove command, it prompts me whether I want to remove a regular empty file ‘Tanvir’? I entered ‘Y’, as I wanted to remove it. After executing the command you can see that the file is not listed in the final directory contents list.

Options:
? rm – rf: This command is used for removing a file forcefully. In the following example, I have tried to forcefully remove “Arpad” files under “Ava” Directory. Forcefully means this command will not ask for confirmation regarding deleting the specific file. It will delete the file without any confirmation.

10. touch: This command is used for creating new empty files. Here I have created a file “Louisa” under “Ashton”. For that, I have first changed my directory to “Ashton”, then created the file named “Louisa” using touch command. pwd command is used to show that we are in “Ashton” directory and at last I have displayed the directory contents using ls command.

11. Locate: This command is used for locating a particular file. Locate reads one or more databases prepared by updated b(8) and writes file names matching at least one of the PATTERNs to standard output, one per line.

12. Clear: This command is used for clearing the screen.


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Showdown: Linux vs Windows for VPS Hosting

As the demand for virtual private servers (VPS) continues to grow, businesses and individuals are faced with a crucial decision:…

2 weeks ago

Questions to Ask Your Web Hosting Support Team

Web hosting is a large industry, as many other factors help any web hosting provider to form a company. The…

2 weeks ago

How to Secure Your WordPress Site in 2025

Welcome to the complete guide to WordPress security best practices in 2024. As technology evolves rapidly, implementing strong security measures…

3 weeks ago

Unlocking the Secrets of Hosting: Essential Questions to Ask Hostripples

Hey, wanted to learn about web hosting? Or do you want to start a new website and need hosting? Questions…

3 weeks ago

DDoS Attacks: What You Need to Know for Protection

In today's digital world, the threat of DDoS attacks has become increasingly prevalent. These types of attacks have the power…

1 month ago