linux basic 4 commands
linux basic 4 commands
System administrators commonly use commands to manage Linux servers. Commands are more efficient
and allow users to automate various tasks more quickly.
In this tutorial, we will explain 60 essential Linux commands for various purposes, from navigation to
software management. Download our Linux command cheat sheet from the link below to access the
information offline.
Prerequisites
To 60 essential Linux commands
Essential Linux commands FAQ
Prerequisites
Before proceeding, access the command-line interface of your Linux desktop or virtual private server
(VPS). If you use a remote system, connect to it using an SSH client like PuTTY or Terminal.
If you don’t have a Linux machine, we recommend purchasing Hostinger’s VPS hosting plan. Our Browser
terminal feature lets you connect to your server directly from the web browser to simplify the process.
Moreover, Hostinger’s Kodee AI assistant can write commands based on your needs. It helps beginners
learn Linux utilities more efficiently, as they don’t need to open documentation for references.
Pro Tip
If you want to check a command’s usage, syntax, and options, use the –help flag. For example, enter ls –
help to display the ls utility guide.
1. ls command
The ls command lists the content of a folder, including files and directories. Here’s the syntax:
ls [options] [directory_or_path]
If you omit the path, the ls command will check the content of your current directory. To list items inside
subfolders, add the -R option. Meanwhile, use -a to show hidden content.
2. pwd command
To check the full path of your current working directory, use the pwd command. Its syntax is as follows:
pwd [options]
The pwd command has only two options. The -L option prints environment variable content, like
shortcuts, instead of the actual path of your current location. Meanwhile, -P outputs the exact location.
For example, /shortcut/folder is a shortcut for /actual/path, and you are currently in /actual/path/dir. If
you use the -L option, the output will be:
/shortcut/folder/dir
/actual/path/dir
3. cd command
Use cd to navigate between directories in your Linux VPS. It doesn’t have any option, and the syntax is
simple:
cd [path_or_directory]
Depending on your location, you might only need to specify the parent directory. For example, omit path
from path/to/directory if you are already inside one. The cd command has several shortcuts:
4. mkdir command
The mkdir command lets you create one or multiple directories. The syntax looks like this:
To create a folder in another location, specify the full path. Otherwise, this command will make the new
item in your current working directory.
mkdir path/to/target_folder/new_folder
By default, mkdir allows the current user to read, write, and execute files in the new folder. You can set
custom privileges during the creation by adding the -m option. To learn more about permission
management, read the chmod section below.