Basic SHELL Commands For Putty
Windows users can log into their server using Putty which is a free SSH,
Telnet and Rlogin client. Putty can be Downloaded here.
No setup is required – it is a standalone executable. Run Putty, enter your IP address into the Host Name (or IP address) field, the port on which your server SSH service is listening, SSH for protocol and then click on Open.
1. Change Password
To change password type passwd then enter the old password and again type a new password, again verify the new password.
2. Update and Upgrade
apt-get update apt-get -s upgrade
3. How to find the current directory
Type pwd to see where on the server you are.
For example, if I type pwd in PuTTy it returns /root
The cd command (also known change directory) is used to navigate to a specified directory on your server.
Such as: cd /home (moves you into the home folder)
If you want to come into same directory then enter
5. How to get root access without root user details?
6. How to move and rename file
Use this command to move and rename file
example: moving a file to another directory
mv earngurus.jpg home/earngurus.jpg
moving a file to another directory and renaming it at once
mv image.jpg home/image2.jpg
7. How to delete / remove a file
rm [file name]
8. Copying a file
To copy a file just use the cp ssh command.
cp file.php /home/file.php
Copy a folder with all files
This one is used to copy the entire folder with all its contents.
Copy and rename
cp file.php /home/file2.php
9. How to copy a folder with all files and folders in it
cp -r [directory] [new directory]
10. How to create new folder
mkdir [folder name]
11. Search for a file
find . -name [filename] -print
example: find a file called “file.jpg” in current folder
find . -name file.jpg -print
12. Create a file
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
13. how to change file permission
chmod [permission type] [file/folder name]
chmod 777 index.php
14. How to list files and/or directories in a directory
list all files and information
Show contents with file size
15. Create a new user account
16. Compressing folders
zip -r foldername.zip foldername
example: zip -r newfolder.zip newfolder
17. Decompressing folders
Example: unzip newfolder.zip
18. Compressing folders using tar -czvf
tar -czvf foldername.tar.gz foldername
Example: tar -czvf wp-content.tar.gz wp-content
19. Decompressing folders using tar -czvf
tar -xvf foldername.tar.gz
Example: tar -xvf wp-content.tar.gz
20. check usage memory
21. Monitor CPU, processes and memory
22. Display sever disk usage