Introducing ZYNOO General Purpose & CPU Optimized Servers   Learn More >

SSH Commands for Beginners: Your First Linux Server Session

SSH commands let you connect to a Linux server securely and manage it from your computer. Whether you’re using a VPS, working with website files, or learning Linux administration, SSH is one of the first skills worth mastering.

The good news is that you don’t need to memorize dozens of commands. Once you understand how to connect to a server and navigate its filesystem, many everyday tasks become straightforward.

In this beginner-friendly SSH tutorial, you’ll learn how to establish your first connection, explore Linux directories, create files, and disconnect safely.

What Is SSH?

SSH (Secure Shell) is a network protocol that provides encrypted communication between your computer and a remote server.

Instead of accessing your server through a graphical control panel, SSH lets you manage it using a command-line interface called a terminal.

For example, you can use SSH to:

  • Manage website files and directories.
  • Install and update software.
  • Check server resources and logs.
  • Transfer files securely.
  • Configure applications and services.

There’s an important difference to understand: SSH connects you to the server, while Linux commands perform tasks after you’re connected.

What Do You Need Before Using SSH?

Before connecting, make sure you have:

  • Server IP address: The address of your Linux server.
  • SSH username: The account you’re authorized to access.
  • Authentication credentials: A password or SSH private key.
  • SSH port: Usually port 22, unless configured differently.
  • SSH client: A terminal application capable of establishing SSH connections.

Linux and macOS include SSH command-line tools. Windows 10 and 11 also support OpenSSH through PowerShell or Windows Terminal when the client is installed.

Your server must have an SSH service running and allow connections from your network.

How to Connect to a Linux Server Using SSH

Open Terminal, PowerShell, or Windows Terminal on your computer.

Enter the following command:

ssh username@203.0.113.10

Replace username with your Linux account name and 203.0.113.10 with your server’s actual IP address.

For example, if your server username is admin, the command becomes:

ssh admin@203.0.113.10

If your server uses a custom SSH port, such as 2222, connect using:

ssh -p 2222 admin@203.0.113.10

When connecting to an unfamiliar server for the first time, SSH may display its host-key fingerprint and ask whether you trust it. Verify the fingerprint through your hosting provider or another trusted source before accepting it.

After authentication, you’ll see a Linux command prompt similar to:

admin@server:~$

Congratulations! You’re now connected to your Linux server.

The commands you enter at this prompt will run on the remote server, not your personal computer.

Understanding the Linux Terminal

Before running commands, let’s understand what the terminal displays.

Consider this example:

admin@server:~$

  • admin represents your current username.
  • server identifies the computer you’re connected to.
  • ~ represents your home directory.
  • $ commonly indicates a regular user’s shell prompt.

Your prompt may look different depending on the Linux distribution and shell configuration.

Now you’re ready to try your first commands.

Your First SSH Commands: A Hands-On Exercise

Rather than memorizing commands individually, let’s complete a simple exercise.

We’ll identify your current location, create a directory, add a text file, and display its contents.

All the changes will take place inside your own home directory.

ZYNOO SSH Commands

Step 1: Check Your Username and Location

Start with:

whoami

This displays the username associated with your current session.

Next, run:

pwd

The pwd command means print working directory. It shows your current location in the filesystem.

For example, you might see:

/home/admin

This means you’re currently working inside the home directory belonging to the admin user.

Step 2: List Files and Directories

Use:

ls -la

This displays files and folders in your current directory, including hidden entries.

The -l option provides detailed information, while -a includes hidden files.

You’ll frequently use ls when browsing directories or checking whether files exist.

Step 3: Create a New Directory

Let’s create a folder for this exercise.

mkdir ~/ssh-practice

The mkdir command creates directories. Here, we’re creating one named ssh-practice in your home folder.

Move into it using:

cd ~/ssh-practice

Now run:

pwd

Your terminal should display a path similar to:

/home/admin/ssh-practice

The cd command stands for change directory. You can use cd .. to move to the parent directory or cd ~ to return home.

Step 4: Create Your First File

Now create an empty text file:

touch hello.txt

The touch command creates the file if it doesn’t already exist. If it does exist, the command updates its timestamps.

Check the directory contents:

ls -l

You should see hello.txt listed.

Let’s add some text:

printf 'Hello from Linux!\n' > hello.txt

The printf command produces the text, while > writes the output to the file.

Be careful: the > operator overwrites the destination file’s existing content.

To display what you’ve written, run:

cat hello.txt

You should see:

Hello from Linux!

You’ve now created a directory, moved into it, written a file, and displayed its contents—all through SSH.

Step 5: Disconnect Safely

When you’ve finished working, enter:

exit

This closes your remote shell session and returns you to your local terminal.

You don’t need to shut down or restart your VPS when disconnecting. The server continues running normally.

How to Transfer Files Using SSH

SSH can also transfer files securely between your computer and server.

One straightforward option is scp (secure copy).

For example, to upload a file from your computer into the practice directory, run this command in your local terminal, not inside the SSH session:

scp ./example.txt admin@203.0.113.10:~/ssh-practice/

Replace the username and IP address with your own details. The local file example.txt must already exist.

To download a file from your server:

scp admin@203.0.113.10:~/ssh-practice/hello.txt ./

This saves a copy of hello.txt in your current local directory.

For interactive file transfers, you can also use SFTP, which operates over an SSH connection.

Understanding SSH Keys

SSH supports password authentication and public-key authentication.

With SSH keys, you create two related keys:

  • Public key: Installed on the server to authorize access.
  • Private key: Kept securely on your computer.

The private key should never be shared.

You can generate an Ed25519 key pair using:

ssh-keygen -t ed25519

Follow the prompts and choose a strong passphrase.

On Linux or macOS, if your server allows an existing login method and ssh-copy-id is installed, you can add the public key using:

ssh-copy-id admin@203.0.113.10

Some VPS providers also allow public keys to be configured through their control panels.

Test your new key-based login before making changes to password authentication.

For beginners, the most important lesson is simple: protect your private key, verify server identities, and never disable an authentication method until you know the replacement works.

Common SSH Connection Errors

SSH connections occasionally fail. Understanding the error message helps identify the problem.

ErrorPossible Cause
Connection timed outNetwork routing, firewall, or unreachable server
Connection refusedSSH service isn’t listening on the specified port
Permission denied (publickey)Incorrect username, SSH key, or server permissions
Host key verification failedThe server’s identity doesn’t match the saved key

If you encounter a connection problem, verify your IP address, username, port, and credentials.

For authentication issues, check that you’re using the correct private key and that its corresponding public key is authorized on the server.

Don’t disable SSH host-key verification to bypass an unexpected warning. Verify the server’s identity first.

Essential SSH Security Tips

Before managing production servers, follow a few basic security practices:

  • Use SSH keys with strong passphrases when supported.
  • Protect your private keys and login credentials.
  • Keep your operating system and SSH software updated.
  • Avoid logging in directly as root unless necessary.
  • Restrict SSH access using appropriate firewall rules.
  • Keep an alternative recovery method available before changing SSH settings.

SSH provides encrypted communication, but your server still requires proper maintenance and access management.

What Should You Learn After SSH?

Once you’re comfortable connecting to Linux and navigating directories, you can gradually expand your skills.

A useful learning order is:

  1. Linux file management: Learn to copy, move, rename, and inspect files.
  2. File permissions: Understand chmod, chown, and administrative privileges.
  3. Software management: Install and update packages using APT or DNF.
  4. Service management: Start, stop, and inspect services using systemctl.
  5. Server monitoring: Check memory, disk usage, and system logs.

These skills will make it easier to manage websites, troubleshoot applications, and maintain Linux servers confidently.

Frequently Asked Questions

What Are SSH Commands Used For?

SSH commands are used to connect to remote systems, execute commands, and transfer files securely. After connecting, you can use Linux shell commands to manage files, software, and server services.

Can I Use SSH on Windows?

Yes. Windows 10 and 11 support OpenSSH, which can be used through PowerShell or Windows Terminal when installed.

Do I Need Root Access to Use SSH?

No. SSH can connect to regular user accounts. Some administrative operations require elevated privileges, but everyday file management and navigation usually don’t.

Is SSH Safe for Beginners?

Yes, provided you understand the commands you execute and follow basic security practices. Start with harmless file and directory operations before attempting system-level changes.

Conclusion

SSH is an essential skill for anyone learning Linux server administration. It provides a secure way to access remote systems, manage files, transfer data, and perform everyday maintenance.

The best way to learn SSH commands is through practice. Start with connecting to your server, navigating directories, and creating files before moving on to more advanced administration tasks.

Once you’re comfortable with your first SSH session, you’ll have the foundation needed for almost every other Linux server tutorial.

Table of Content

Nginx rate limiting is a built-in feature that controls how many HTTP requests a client

An Nginx reverse proxy receives requests from website visitors and forwards them to another server

A 502 Bad Gateway error in Nginx usually means Nginx couldn’t receive a valid response

Build your next project with ZYNOO

From your first website to demanding applications, choose the resources and control you need.

Shared Hosting

Start your blog or business website with cPanel, LiteSpeed and CloudLinux.

VPS Hosting

Grow your websites and applications with NVMe storage, KVM virtualization and full root access.

Dedicated Servers

Power demanding projects with your own physical server, dedicated resources and control over your environment.

Scroll to Top