Basic Linux commands list with example and syntax for Beginners

Today we will discuss basic Linux commands list with example and syntax for Beginners Hey Guys How are you all? I hope you guys are doing well. I have got some e-mails from peoples to make a post regarding the basic commands which we can use in the Linux and termux and I think this post will be good for beginners. 

Today's topic helps you to understand the file systems as well as how we can manage it. So without wasting any time lets get started.

Understanding the Filesystem Tree:

A Unix-like software system like Linux organizes its files in what's referred to as a stratified structure. this implies that they're organized in an exceedingly tree-like pattern of directories (sometimes referred to as folders in different systems), which can contain files and different directories. the primary directory within the filesystem is named the foundation directory. the foundation directory contains files and subdirectories, that contain a lot of files and subdirectories, and so on.

Listing files (ls) :

To list the files and directories within the current operating directory, we use the ls command. Actually, we will use the ls command to list the contents of any directory, not simply the present operating directory, and it will do several different fun things as well.


  • Directories are denoted in blue color.
  • Files are denoted in white.

Ls -al: It will show you the detailed list of the directories and files.

Ls -a: It is used to view hidden files.

Read Also: Hack Android Phone using Ngrok over internet

Creating & Displaying Files:

1. Creating the new file

Basically, 'cat' command is used to display text files, combining and creating new text files. Let's have a look.

$cat > hackmingtxt

Enter the text

Ctrl+d for Linux user and volume down+d for termux users.

2. Displaying the file :

The command which we are using for creating a file the same cat command is used for displaying the text contained in the file.

$ cat < filename >

3. Combining 2 files:

As you can see I have 2 files hackmingtxt & hackmingtxt2. By using  Cat command I have combined the two files into one.

$cat hackmingtxt hackmingtxt2 > Hackmingnew

Manipulating Directories:

1. mkdir --- Create Directories

Now we play with directories. To make a directory use mkdir command. I am making 2 directories here directory1 & directory2.

2. rm --- Remove Directory :

rmdir command is used to remove the directory.

rmdir <directory_name>

3. mv --- Move and Rename Files:

The mv command performs both file moving and file renaming, depending on how it is used. In either case, the original filename no longer exists after the operation. mv is used in much the same way as cp:

To move or rename file or directory item1 to item2
$mv item1 item2


To move one or more items from one directory to another
$mv item... directory

Read also:  How to write SMTP Brute Force Script using Python

Basic Commands:

chmod Command

chmod command is used to change/update file access permissions like this.
$ chmod +x

clear Command

clear command lets you clear the terminal screen, simply type.
$ clear

cmp Command

cmp performs a byte-by-byte comparison of two files like this.
$ cmp file1 file2

comm Command

comm command is used to compare two sorted files line-by-line as shown below.
$ comm file1 file2

ip Command

ip command is employed to show or manage routing, devices, policy routing and tunnels. It conjointly works as a replacement for documented ifconfig command.
This command will assign an IP address to a specific interface (eth1 in this case).

$ sudo ip addr add dev eth1

nmap Command

nmap could be a well-liked and powerful open supply tool for network scanning and security auditing. it had been supposed to quickly scan massive networks, however, it conjointly works fine against single hosts.

The command below can probe open ports on all live hosts on the required network.

$ nmap -sV

grep Command

Grep Command searches for a specified pattern in a file (or files) and displays in output lines containing that pattern as follow:

$ grep ‘tecmint’ domain-list.txt

netstat Command

netstat command displays helpful data regarding the UNIX system networking scheme (network connections, routing tables, interface statistics, masquerade connections, and multicast memberships).

This command can show all open ports on the native system:

$ netstat -a | more

passwd Command

passwd command is employed to create/update passwords for user accounts, it may also modify the account or associated watchword validity amount. Note that standard system users could solely modify the watchword of their own account, whereas root could modify the watchword for an account.

$ passwd hackming

Subscribe my Newsfeed to get the latest post updates.

Post a Comment