• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Basic SSH Commands, Most used putty commands

Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
4 Posts 4 Posters 8.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    JohnnieGaines
    last edited by JohnnieGaines May 17, 2019, 10:36 AM May 13, 2019, 5:57 AM

    1. How to find out where you are, the pwd command shows you present working directory.
      pwd

    2. Change directory
      cd

    The cd command is used to navigate into a specified directory on your server.

    Example: cd /home (moves you into the home folder)

    1. The same directory

    cd .
    Using this command you will remain in the same directory you were.

    1. Move me up one directory

    cd ..
    Above command will navigate two steps back from current directory

    1. Go to the previous directory

    cd –
    Above command will navigate to the previous directory.

    1. Go to Home folder

    cd ~
    Above command will navigate to the home directory on your server.

    1. Go to root

    cd /
    Above command will navigate to root.

    How to List Directories and Contents
    8) List files

    ls
    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.

    1. Show me all files in a directory

    ls -a
    10) Show contents with file size

    ls -h
    If you wish to see a directory’s contents with file sizes just type ls -h

    1. How to see sub-directories recursively

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

    1. How to see files by file size

    ls -is
    13) List all folders in directory with details

    ls -alh
    How to Copy files/folders with Putty Commands
    14) Copying a file

    cp
    To copy a file just use the cp ssh command.

    Example:

    cp filename.php /home/filename.php

    1. Copy a folder with all files

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

    1. Copy and rename

    cp filename.php /home/filename2.php
    How to Move files to different locations
    17) Moving a file

    mv
    Example: mv page.php /home/page.php

    1. 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

    mkdir

    example: mkdir new-folder

    1. Create a file

    touch
    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

    1. uncompressing folders

    unzip
    Example: unzip newfolder.zip

    1. Compressing folders using tar -czvf

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

    1. 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

    rm
    To delete a file on your server just use the rm command.

    Example: rm index.php

    1. Delete all files from a directory

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

    Example: rm * foldername

    1. Delete a folder/directory

    rmdir
    Use this command to remove directories.

    How to change File permissions?
    29) Change file permissions

    chmod
    Example: chmod 775 newfolder

    1. 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.

    https://www.puttygen.com/putty-commands

    1 Reply Last reply Reply Quote 0
    • J
      JKnott
      last edited by May 13, 2019, 10:54 AM

      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.

      PfSense running on Qotom mini PC
      i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
      UniFi AC-Lite access point

      I haven't lost my mind. It's around here...somewhere...

      1 Reply Last reply Reply Quote 0
      • S
        stephenw10 Netgate Administrator
        last edited by May 13, 2019, 12:34 PM

        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. 🙄

        Steve

        1 Reply Last reply Reply Quote 0
        • J
          johnpoz LAYER 8 Global Moderator
          last edited by johnpoz May 13, 2019, 1:03 PM May 13, 2019, 1:01 PM

          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..

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          2 out of 4
          • First post
            2/4
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
            This community forum collects and processes your personal information.
            consent.not_received