0% found this document useful (0 votes)
433 views

How To Use PuTTy and Commands

This document provides 35 useful SSH commands for managing Linux servers remotely. Some key commands include: - ls to list files and directories - cd to navigate directories - cp to copy files - mv to move files - rm to delete files - mkdir to create directories - chmod to modify file permissions - free to check memory usage - top to monitor system processes and resources The commands cover basic file management tasks like copying, moving, deleting and compressing files as well as system monitoring commands for checking disk usage, processes, memory and more.

Uploaded by

Elong Most
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
433 views

How To Use PuTTy and Commands

This document provides 35 useful SSH commands for managing Linux servers remotely. Some key commands include: - ls to list files and directories - cd to navigate directories - cp to copy files - mv to move files - rm to delete files - mkdir to create directories - chmod to modify file permissions - free to check memory usage - top to monitor system processes and resources The commands cover basic file management tasks like copying, moving, deleting and compressing files as well as system monitoring commands for checking disk usage, processes, memory and more.

Uploaded by

Elong Most
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

How To Use PuTTy To Login To Your Server

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.

Just enter your username and then your password.


To copy paste in PuTTy just right click and it will automatically paste.
Note: Ubuntu does NOT show passwords not even asterisks so dont worry when you are
typing your passwords and nothing shows on the screen.
And tadaaa!

Youve successfully logged on to your server.

35 Useful SSH Commands


Now that you know how to use a SSH client we can take a look at a few useful ssh command lines
and what they do.
Ive compiled this list of SSH commands for anyone who struggles to managed their Linux servers.

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:

3.) The same directory


cd .
The cd . command does basically nothing. Using this command you will remain in the same
directory you were.

4.) Move me up one directory


cd ..
Remember the previous command? Well I included it for a reason!
Add another dot(stop) to cd . and you will end up with cd .. which will move you up one directory.

5.) Go to the previous directory


cd
The cd command is used when you want to go to the previous directory.

6.) Go to Home folder


cd ~
The cd ~ commands is used when you want to go to the home directory on your server.

7.) Go to root

cd /
The cd / command is used when you want to jump to root.

List Directories and Contents


8.) List files
ls
usage: ls [option] [file]
Using the ls command in a folder will display all its content.
Such as: ls /home.
Will return all content of the folder /home.

9.) Show me all files in a directory


ls -a

10.) Show contents with file size


ls -h
If you wish to see a directorys contents with file sizes just type ls -h

11.) How to list sub-directories recursively


ls -r
The ls -r command is used to list sub-directories recursively.

12.) How to list files by file size


ls -is
Use this ssh command to list files by size.

13.) List all folders in directory with details


ls -alh
This one is very useful when you want to see more details about certain files.
For example you may want to know file permissions of a directory.

Copying files
14.) Copying a file
cp
To copy a file just use the cp ssh command.
Example:
cp filename.php /home/filename.php

15.) Copy a folder with all files


cp -r
This one is used to copy the entire folder with all its contents.

16.) Copy and rename


cp filename.php /home/filename2.php

Moving files
17.) Moving a file
mv
Example:
mv page.php /home/page.php

18.) Move and rename


mv page.php /home/newpage.php

19.) Move file up one directory


mv filename ..
example: mv index.html/ ..

Creating files/folders
20.) Create a folder
mkdir
example: mkdir new-folder

21.) Create a file


touch
Use the touch command to create different files and file extensions (you can later edit them)
Example:
touch index.php
touch index.html
touch robots.txt

Compressing/Decompressing files
22.) Compressing folders
zip -r foldername.zip foldername
Example:
zip -r newfolder.zip newfolder

23.) Decompressing folders


unzip
Example:
unzip newfolder.zip

24.) Compressing folders using tar -czvf


tar -czvf foldername.tar.gz foldername
Example:
tar -czvf wp-content.tar.gz wp-content

25.) Decompressing folders using tar -czvf


tar -xvf foldername.tar.gz
Example:
tar -xvf wp-content.tar.gz

Delete/Remove files
26.) Delete a file
rm
To delete a file on your server just use the rm command.
Example:
rm index.php

27.) Delete all files from a directory


rm *
This command is used to delete all contents from a directory.
Example:
rm * foldername

28.) Delete a folder/directory


rmdir
Use this command to remove directories.
Heres how: rmdir foldername

File permissions
29.) Change file permissions
chmod
Example:
chmod 775 newfolder

30.) Change permissions of folder and all files inside


chmod -r
This command comes in handy when you want to change file permissions of an entire folder
including its contents.

Miscellaneous
31.) Memory usage
free -m
Great command to monitor memory usage!

32.) What user am I?


whoami
If you dont know what user your are just use whoami

33.) Show network connections


netstat
Displays current networks connections

34.) Monitor CPU, processes and memory


top
Type to to monitor CPU usage, processes and RAM.

35.) Display sever disk usage


df -h
If you want to see how much disk is used on your server just type df -h

You might also like