Basic SSH Commands, Most used putty commands
How to find out where you are, the pwd command shows you present working directory.
The cd command is used to navigate into a specified directory on your server.
Example: cd /home (moves you into the home folder)
- The same directory
Using this command you will remain in the same directory you were.
- Move me up one directory
Above command will navigate two steps back from current directory
- Go to the previous directory
Above command will navigate to the previous directory.
- Go to Home folder
Above command will navigate to the home directory on your server.
- Go to root
Above command will navigate to root.
How to List Directories and Contents
8) List files
usage: ls [option] [file]
Using the ls command in a folder will display all it’s content.
Example: ls /home.
Will return all content of the folder /home.
- Show me all files in a directory
10) Show contents with file size
If you wish to see a directory’s contents with file sizes just type ls -h
- How to see sub-directories recursively
The ls -r command is used to see sub-directories recursively.
- How to see files by file size
13) List all folders in directory with details
How to Copy files/folders with Putty Commands
14) Copying a file
To copy a file just use the cp ssh command.
cp filename.php /home/filename.php
- Copy a folder with all files
This one is used to copy the entire folder with all it’s contents.
- Copy and rename
cp filename.php /home/filename2.php
How to Move files to different locations
17) Moving a file
Example: mv page.php /home/page.php
- Move and rename
mv page.php /home/newpage.php
19) Move file up one directory
mv filename ..
example: mv index.html/ ..
How to Create files/folders using Putty Commands
20) Create a folder
example: mkdir new-folder
- Create a file
Use the touch command to create different files and file extensions
Example: touch index.php
How to Compress/Uncompress files?
22) Compressing folders
zip -r foldername.zip foldername
Example: zip -r newfolder.zip newfolder
- uncompressing folders
Example: unzip newfolder.zip
- Compressing folders using tar -czvf
tar -czvf foldername.tar.gz foldername
Example: tar -czvf wp-content.tar.gz wp-content
- uncompressing folders using tar -czvf
tar -xvf foldername.tar.gz
Example: tar -xvf wp-content.tar.gz
How to Delete/Remove files?
26) Delete a file
To delete a file on your server just use the rm command.
Example: rm index.php
- Delete all files from a directory
This command is used to delete all contents from a directory.
Example: rm * foldername
- Delete a folder/directory
Use this command to remove directories.
How to change File permissions?
29) Change file permissions
Example: chmod 775 newfolder
- Change permissions of folder and all files inside
chmod 755 folder name -R
Thanks for reading our article and we will keep updating the same articles with more useful commands in coming days. Keep checking this space for more Putty commands.
JKnott last edited by
PuTTY commands? PuTTY is a terminal emulator. All the commands I see listed are shell commands. I often issue Linux shell commands, as well as BSD with pfSense. I do not normally use PuTTY and, as far as I've seen, it's not available for LInux, which is my desktop OS.
PuTTY is available for Linux. I use it for serial connections all the time. Obviously little point in using it for SSH there except maybe login storage. There are better options for that though.
But, yes, these are shell commands, there is nothing PuTTY specific about them. They are not SSH commands either.
For what possible reason does a someone post such a thing in their first post??
Ah - its spam.. who removed the link that was in the original post? I see it in the revision history..