# Introduction to Linux commands

> Learn essential Linux commands for navigating folders, managing files and checking your account over SSH.

Source: https://helpcenter.ruachost.com/developers/linux/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.

## The Command Line Environment

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

```bash
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.

## Listing Files and Directories

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

```bash
ls
```

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

```bash
ls -l
```

## Navigating the Directory Tree

To display your current directory:

```bash
pwd
```

This shows your **present working directory**.

To move into another directory, for example, `public_html`:

```bash
cd public_html
```

To return to your home directory:

```bash
cd ~
```

## Tip

- Use `cd ..` to go up one level (to the parent directory).
- Use `.` to refer to the current directory.

## Finding Files

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

```bash
find . -name '*.html'
```

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

```bash
man find
```

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

## Finding the Path to a Program

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

```bash
whereis -b grep
```

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

```bash
whereis grep
```

## Creating and Removing Directories

Create a directory:

```
mkdir backup
```

Remove an empty directory:

```
rmdir backup
```

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

## Copying, Moving, and Deleting Files

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
```

## Checking Disk Usage and Free Space

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.

## More Information

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.
