SSH is a secure and beneficial method for automating scripts on remote servers. On UNIX and Linux systems, the setup of SSH is almost trivial.
SSH is a secure shell protocol use to log in to a remote server. For generating an SSH key you require to Download Putty. It is a freely available third-party ssh client for the Windows platform.
Putty is a key generating tool used for creating ssh keys. If you are ssh user then you already know about ssh commands. This article covers "how to generate ssh commands".
How to use Putty to log in to Server?
As we already mentioned, Putty is a key generator used to connect to your Linux server from a Windows system. For connection, you required -
A Linux based server
Putty installed on your computer
The server’s IP address
Username
Password
Usually, all the information you need is emailed to you by your cloud hosting provider automatically when you create a new server.
Once you have all the essential information you can continue connecting to your VPS using Putty.
Testing an internal command over SSH using Putty
Run the SSH server.
Run putty and store the IP and port of the SSH server.
In the putty configuration, user SSH, de-select the check box that says "Don't start a shell or a command at all" and start an internal command in the "Remote Command" text box.
Start the putty session and continue with authentication.
Once authentication is complete, we see the output of the "iface" command on the putty screen.
Try Useful SSH Commands
Now that you know how to use an SSH client we can take a look at a few useful ssh command lines and what they do. We gathered this list of SSH commands for anyone who tries to manage their Linux servers.
Let's start with the Basic Navigation Commands -
How to find out where you are
pwd
Type pwd to see where on the server you are.
Navigate to..
cd The
cd command (also known as change directory) is used to navigate into a specified directory on your server.
Such as - cd /home (moves you into the home folder)
The same directory
cd.
The cd . command does nothing. Using this command you will remain in the same directory you were.
Move me up one directory
cd.
Remember the previous command? Well, we covered it for a reason!
Add another dot to cd . and you will end up with cd .. which will move you up one directory.
Go to the previous directory
cd –
The cd – command is used when you want to go to the previous directory.
Go to Home folder
cd
The cd - commands are used when you want to go to the home directory on your server.
Go to root
cd /
The cd/command is used when you want to jump to root. Now we jump to the
List Directories and content -
List files
ls
usage: ls [option] [file] Using the ls command in a folder will display all its content.
Such as - ls /home.
Will replace all content of the folder /home.
Show me all files in a directory
ls -a
Show contents with file size
ls -h
If you want to see a directory’s contents with file sizes just type ls -h
How to list subdirectories recursively
ls -r
The ls -r command is used to list subdirectories recursively.
How to list files by file size
ls -is
Use this ssh command to list files by size.
List all folders in a directory with details
ls -alh
This one is very useful when you require to observe more details about certain files. For example, you may want to know the file permissions of a directory.
Conclusion
This article involves "SSH Commands". Read the article and get aware of the ssh commands while using it. Thank you.