ShellSage
ShellSage mobile terminal showing essential SSH command workflow cards
SSH BASICS

Essential SSH Commands Every Developer Should Know

Learn key SSH commands to streamline your development workflow.


SSH is a powerful tool for remote server management, allowing secure communication between systems. Knowing essential commands can greatly enhance your productivity.

How do you establish an SSH connection?

Establishing an SSH connection is fundamental for remote server management. You can initiate a connection using the command ssh user@host. Replace user with your username and host with the server's IP address or domain name.

For example, to connect as the user john to a server at 192.168.1.10, you would use:

ssh john@192.168.1.10

This command prompts for the user's password unless key-based authentication is set up. Key-based authentication is more secure and eliminates the need for a password. To set it up, generate a key pair using ssh-keygen and copy your public key to the server with ssh-copy-id user@host.

Establishing an SSH connection is as simple as using ssh user@host.

How can you transfer files over SSH?

Transferring files over SSH is commonly done using scp (secure copy protocol). The syntax is scp source_file user@host:destination_path. This command securely copies the file from your local machine to the server.

For instance, to copy a file named data.txt to the home directory of john on 192.168.1.10, use:

scp data.txt john@192.168.1.10:~

Similarly, you can download files from the server by reversing the order: scp user@host:source_file destination_path.

While most SSH clients like Termius and JuiceSSH require you to manually enter these commands, ShellSage simplifies this with real SFTP support, allowing drag-and-drop file transfers directly from your phone.

Use scp to transfer files securely over SSH.

How do you execute remote commands?

Executing commands on a remote server without logging in interactively is a powerful feature of SSH. Use ssh user@host 'command' to run a command directly. This is useful for automating tasks or quickly checking system status.

For example, to list the contents of /var/www on a remote server, use:

ssh john@192.168.1.10 'ls /var/www'

Remember, the command must be enclosed in single quotes to execute correctly. This technique is especially helpful in scripts where manual login is impractical.

What is SSH port forwarding?

SSH port forwarding, also known as tunneling, allows you to securely forward network traffic between your local and remote machines. It's useful for accessing services behind a firewall or encrypting traffic between client and server.

There are two types of port forwarding: local and remote. Local forwarding forwards a local port to a remote service. For instance, to forward local port 8080 to a remote web server on port 80, use:

ssh -L 8080:localhost:80 user@host

Remote forwarding, on the other hand, forwards a remote port to a local service. This is done with -R instead of -L.

While Termius supports basic port forwarding, ShellSage's blast-radius preview helps you understand the impact of these commands before executing them, reducing the risk of misconfigurations.

When should you use a reverse tunnel?

Reverse tunneling is useful when you need to access a local service from a remote machine, especially when the local machine is behind a firewall or NAT. It involves setting up a tunnel from the remote machine back to your local machine.

To create a reverse tunnel, use the -R option. For example, to access a local web server running on port 3000 from a remote server, use:

ssh -R 9000:localhost:3000 user@remote_host

This command makes the local web server accessible on remote_host at port 9000. Reverse tunnels are powerful for remote access and troubleshooting.

Most mobile SSH clients, like Blink Shell, require manual setup for reverse tunnels. ShellSage simplifies it with voice input and AI to guide you through complex configurations.

Understanding these commands can significantly enhance your ability to manage servers effectively. Whether you're transferring files, running remote commands, or setting up tunnels, mastering SSH is crucial for developers and sysadmins.

⚡ Key takeaways

Priya Nair
Your Questions, Answered

Frequently Asked Questions

To establish an SSH connection, use the command ssh user@host, replacing 'user' with your username and 'host' with the server's IP address or domain name. This command will prompt you for a password unless you have set up key-based authentication. ShellSage simplifies this process on mobile by offering voice input and an AI assistant to guide you through establishing secure connections.
You can transfer files over SSH using the scp (secure copy protocol) command. The syntax is scp source_file user@host:destination_path, which securely copies the file to the specified destination. With ShellSage, you can easily perform file transfers on your phone using real SFTP capabilities, enhancing the convenience of mobile file management.
Yes, you can use an SSH terminal on a phone. There are various apps available that provide SSH client functionalities, allowing you to manage servers remotely. ShellSage is one such app, offering an AI-first SSH/SFTP experience with features like voice input and a destructive-command shield to enhance mobile SSH management.
ShellSage offers a free version with basic features, allowing you to use its SSH and SFTP functionalities on your phone. For advanced features, such as enhanced AI assistance and additional security options, there may be premium plans available.
ShellSage requires an internet connection to establish SSH and SFTP connections to remote servers. However, once connected, some functionalities like local file management and certain AI-driven commands may be available offline.
ShellSage keeps the key in encrypted secure storage on the device, with an optional biometric gate before any host will connect, and host-key pinning to catch an impostor server. Saving a host also syncs it: the key or password is uploaded and stored encrypted at rest (AES-256) on ShellSage's servers so your hosts follow you between devices. Be clear-eyed about the trade , that is encryption at rest, not zero-knowledge, so the server can decrypt the credential to return it at connect time. Delete the host, or the account, and the stored secret is destroyed with it.
Yes, ShellSage can run AI commands to assist you with various tasks. The built-in AI assistant, Sage, helps automate and streamline SSH operations, offering suggestions, and providing guidance directly from your mobile device.
Download ShellSage free
ShellSage is an AI-first SSH terminal with Sage built in: it explains output, fixes broken commands, and previews the blast radius before anything runs. Start on the free Hobby plan with no credit card, and get a 7-day full-Pro trial when you want everything.
← More tutorials