How To Use PuTTy and Commands
How To Use PuTTy and Commands
As I previously mentioned PuTTy is used to connect to your Linux server from a Windows based
machine.
What you will need:
o
A Linux based server
o
PuTTy installed on your computer
o
The servers IP address
o
Username
o
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 necessary information you can proceed connecting to your VPS using PuTTy.
Heres how:
Download PuTTy and save it on your desktop. You dont have to install it just click on it and it will run
out of the box.
When you first open the program you will see something like this:
Out of all those options we are interested in welljust one and thats the Host Name field(the IP
address).
Thats where you will need to input your own servers IP address in order to connect to it.
Just enter the IP address making sure the connection type SSH is checked and port is 22.
Hit open.
You will be presented with a black screen like this:
I remember first when I saw this I freaked out but instinctively I knew I had to login first.
Basic Navigation
1.) How to find out where you are
pwd
Type pwd to see where on the server you are.
For example if I type pwd in PuTTy it returns /root
2.) Navigate to
cd
The cd command (also known change directory) is used to navigate into a specified directory on
your server.
Such as:
cd /home (moves you into the home folder)
Example:
or
Say I want to navigate to the /etc directory. All I have to do is type cd /etc.
Example:
7.) Go to root
cd /
The cd / command is used when you want to jump to root.
Copying files
14.) Copying a file
cp
To copy a file just use the cp ssh command.
Example:
cp filename.php /home/filename.php
Moving files
17.) Moving a file
mv
Example:
mv page.php /home/page.php
Creating files/folders
20.) Create a folder
mkdir
example: mkdir new-folder
Compressing/Decompressing files
22.) Compressing folders
zip -r foldername.zip foldername
Example:
zip -r newfolder.zip newfolder
Delete/Remove files
26.) Delete a file
rm
To delete a file on your server just use the rm command.
Example:
rm index.php
File permissions
29.) Change file permissions
chmod
Example:
chmod 775 newfolder
Miscellaneous
31.) Memory usage
free -m
Great command to monitor memory usage!