Skip to content

Introduction to Linux commands

Introduction to Linux Commands

This guide introduces some of the most essential Linux commands. Understanding the Linux command line (also called the shell or terminal) is useful when setting up configurations, installing software manually, or simply gaining deeper insight into how your website operates.

Note:
This article assumes you already know how to access your account using SSH (Secure Shell). If not, please review the related article on how to connect via SSH first.

When you log in to your account using SSH, you’ll see the Linux command prompt:

Terminal window
username@example.com [~]#

The tilde symbol ~ indicates you’re in your home directory, usually /home/username. From here, you can run commands to navigate, view, and manage files.

To see what’s inside your current directory, type:

Terminal window
ls

This command lists all files and directories. For a detailed view (including permissions, size, and modification date), use:

Terminal window
ls -l

To display your current directory:

Terminal window
pwd

This shows your present working directory.

To move into another directory, for example, public_html:

Terminal window
cd public_html

To return to your home directory:

Terminal window
cd ~
  • Use cd .. to go up one level (to the parent directory).
  • Use . to refer to the current directory.

To search for files in your current directory and its subdirectories, use the find command.
Example — find all .html files:

Terminal window
find . -name '*.html'

Tip:
For help with any Linux command, use the man command to read its manual page:

Terminal window
man find

Use Page Up/Page Down to scroll and q to quit.

To locate where a program is installed, use whereis.
Example:

Terminal window
whereis -b grep

This shows the executable path. To include help files as well, omit the -b option:

Terminal window
whereis grep

Create a directory:

mkdir backup

Remove an empty directory:

rmdir backup

Note:
rmdir only removes empty directories. Delete files inside before using it.

Copy a file:

cp index.html backup

If backup is a directory, the file will be copied into it. Otherwise, a new file named backup is created in the same directory.

Move or rename a file:

mv index.html backup

If backup is a directory, the file moves there; otherwise, it renames the file to backup.

Delete a file:

rm old.html

To see how much space a directory uses:

du -h

This displays human-readable disk usage statistics.

To check free disk space:

df -h

Note:
df is most useful on VPS or dedicated servers where you manage the entire disk. On shared hosting, disk space is managed by the provider.

This guide covers only basic Linux commands. There are many more powerful tools and tutorials available.
For deeper learning, visit linuxcommand.org, which offers detailed guides and a free downloadable book on mastering the command line.