We talked about SSH in the past and learned that SSH is a cryptographic network protocol for operating network services over an unsecured network. SSH provides an encrypted secure channel between you and the server without the need for a secure network. Today, I will show you 15 most used SSH commands. Specifically, must know SSH commands and Raspberry Pi SSH commands to help you get by in the SSH world. Without further ado, let's get started. [Read: Introduction to SSH: What is SSH?]
Table of Contents
SSH for Raspberry Pi
In order to use the SSH commands shown in this article, you can connect via SSH from your smartphone using JuiceSSH. If you need to connect from a Windows machine, here are 10 best SSH clients for Windows.
15 most used SSH commands - Raspberry Pi SSH commands
apt-get update
apt-get update
This is one of the most used SSH commands on every Linux distribution. It updates the package list and shows information on the newest version of packages and their dependencies.
apt-get upgrade
apt-get upgrade
Following the update command, apt-get upgrade
is a must know SSH command. By running it, it will download the new versions of packages based on the update performed before, and install them.
mkdir
mkdir
Another must-know SSH command, mkdir
will create a new folder. By running the command mkdir Projects
you create a new folder called "Projects."
rm
rm
The rm
command removes a folder or file. By running the command rm Projects
you remove the folder called "Projects."
touch
touch
One of the most used SSH commands used to create a file. By running the command touch readme.txt
you will create the file readme.txt on your file system.
ls
ls
When running the ls
command, you are listing all the files from the folder you are located. Below, the ls
command was used in the /
location.
nano
nano
A commonly used SSH editor, Nano allows you to edit files right in the SSH windows. By running the command nano
followed by the location of the file, you open the file for editing, making it one of the most used Raspberry Pi SSH commands.
reboot
reboot
Pretty much self-explanatory. When you run the reboot
command, the system will perform a restart. This is a must-know SSH command for Raspberry Pi in order to remotely perform a reboot.
startx
startx
This is the command used to open the graphical user interface (GUI). It is one of the most used Raspberry Pi SSH commands after booting in a Linux distribution, like Debian.
ifconfig
ifconfig
With the ifconfig
command, you show the status of the network. It's the easiest way to determine the IP of the machine making it one of the must-know SSH commands.
wget
wget
The command wget
retrieves content from web servers. With this command, you can download a file from a web page. For instance, wget http://downloads.com/file.txt
will download the file.txt locally to your machine.
raspi-config
raspi-config
Used when the configuration menu for the Raspberry Pi needs to be accessed.
top
top
The top
command is one of the must-know SSH commands for Linux systems for opening the integrated "task manager" from Linux. It shows the running processes list, CPU, memory, and disk usage.
top
is included with all Linux operating systems, but if you need more information from SSH, make sure you check htop which is an improved version of top
. You can find more information about htop in our introduction to SSH and htop for Linux article
arrow up key
Although it's not technically a command, this is extremely useful for new SSH users. When you press arrow up key, you bring up the last entered command. When pressing the key multiple times, you can bring up older commands entered in the past.
Recommended Guides Secure Shell/SSH:
ping
ping
One of the most used Raspberry Pi SSH commands, and also one of the most popular SSH commands available, ping
allows you to test the connectivity to another host. By running ping 192.168.0.2
you can test if there is connectivity between your machine and the other. When you run the ping raspberry
command, you test the connectivity to the machine named Raspberry. Besides that, you also get the IP used by the machine named "raspberry."
You learned the must know SSH commands: What to do next
Congratulations! After learning the 15 most used SSH commands, you are now able to get around when connecting via SSH. If you want to expand your SSH knowledge, check our article on how to simplify SSH access by using SSH config file on a remote server and connecting to Ubuntu Server using SSH Keys and Putty. There are a lot more commands available so make sure you check back soon, for new articles about SSH.