Basic SSH Commands

Updated on Monday, December 28th, 2009 at 1:25 pm

I have had people asking me about SSH commands, and the basic commands, to at least get them going.


The list below is not meant to be a complete SSH guide, but more so a list of some of the basic commands and what they do, as well as the proper formatting for the command.


I’ll start with what I think is the most basic, and work my way up.


In this guide, I’ll assume you at least have some SSH software, if not, I’ll list a few of my favorites.


Command: cd
Format: cd /directory/you/want/to/go/to
This command is the most basic, and widely used.  The cd command is used to move to the directory you specify.


Command: cp
Format: cp /directory/you/want/to/copy /directory/where/you/want/to/copy/to
The cp command will copy the file or folder you specify in the first portion, to the location you specify in the second portion.


Command: mkdir
Format: mkdir /directory/you/want/to/create
mkdir creates the directory or folder you specify


Command: rmdir
Format: rmdir /directory/you/want/to/delete
The rmdir command deletes the directory or folder you specify.


Command: mv
Format: mv /directory/you/want/to/rename/or/move /new/directory/name/or/location
The mv command will rename or move the file stated in the first portion to the name or location stated in the second portion.


Command: rm
Format: rm filename.pl
The rm command will move the file specified.


Command: tar cvf
Format: tar cvf filename.tar.gz /directory/you/wish/to/archive
This command will tar zip the files in the directory specified in the second portion into a tar file specified in the first portion.


Command: tar -xvf
Format: tar -xvf filename.tar.gz
The tar -xvf will extract all files from the tarball specified into the directory you are currently in.


Command: zip
Format: zip yourfile.zip /file/or/folder/you/want/to/zip
This will create a zip file, with the name specified in the first portion from the file or directory listed in the second portion.


Command: unzip
Format: unzip yourfile.zip
This command will unzip or un pack the named zip file, into the directory you’re currently in.


Command: Ls
Format: Ls /directory/you/wish/to/list/files/
The Ls command lists files, and folders within the directory you specify



Command: Ls -f
Format: Ls -f /directory/you/wish/to/list/files/
This will add a forward slash to the directory names within the directory you specify


Command: Ls -a
Format: Ls -a /directory/you/wish/to/list/files/
This will show “hidden” files in the directory you specify


Command: Ls -l
Format: Ls -l /directory/you/wish/to/list/files/
This command shows detailed info about each file in the directory you specify.


Some suggested SSH software
As I stated earlier, I will give a few of my favorite SSH clients, and where you can obtain them.


Putty
SSH Secure Shell Client

Related posts brought to you by Yet Another Related Posts Plugin.

5 Responses to “Basic SSH Commands”

  1. Admin Z (1 comments) Says:

    This article is real good for begineers who can understand the basic command structure in linux.

    Thanks for posting.

    Admin

  2. Will (1 comments) Says:

    Agreed. Very good article for beginners!

    Thanks for putting this together!

    Will
    Will´s last [type] ..Hello world!

  3. jeffatrackaid (1 comments) Says:

    If you work a lot at the command line, you may also want to learn how to use Linux Screen. I wrote a tutorial here:
    http://www.rackaid.com/resourc.....nd-how-to/

    With screen if you lose your shell session, you can re-connect and it will still be there. Very important if you are editing files or have long running command line processes.
    jeffatrackaid´s last [type] ..Email Going to Spam Folder

  4. Kaushik Biswas (2 comments) Says:

    I learned some SSH Commands from a person much junior to me; it was when I was learning the basics of an IRC Server, Chat Robots etc. Now I have forgot all of those commands. But it feels nice to see some commands in your post.
    Kaushik Biswas´s last [type] ..Southern California spa- now Steam bath with a difference

  5. Anne-Mieke Bovelett (1 comments) Says:

    Wow….

    You posted this article ages ago but I am very happy you did and I found it today. As a non technical member (I do marketing) of a very technical dev team I have been “goaded” into using Ubuntu, and when I see them guys execute stuff on a server in a heartbeat, I understand why.
    Goodby GUI FTP , hello Putty :) Your article is a life saver for me. Thank you!

Leave a Reply

CommentLuv badge