SSH Cheat Sheet

By Joe Gardiner Thursday, 3rd March 2011

This is guide is set out to provide SSH beginners with the most commonly used commands to get them started. Of course if you’re an old hand at SSH but have a bad memory then this may be the place for you too!


Simple navigation commands

Command Result
pwd Displays the full directory path of the current directory
ls Displays all the files in the current directory that are not hidden
ls -al Displays all the files in the current directory and file information
ls *.txt Displays all files in the current directory ending with .txt
cd Directory Name Change to a different directory
cd .. Moves up one directory
clear Clears all the content on the terminal screen
exit Logs off your shell and clears the terminal

File Management

Command Result
mv [Old filename] [New Filename] Use to move or rename a file
cp [Filename] [New Filename] Makes a copy of the file with a new filename
rm Deletes a file
rm -f Deletes a file without a confirmation prompt

Directory Management

Command Result
mkdir [Directory name] Creates a directory with the chosen name
ls -d * / Displays all the directories that exist inside your current directory
cp -r [Current directory] [New directory] Copies a directory and all of its contents to a new directory with the chosen name
rm -r -f [Directory] Deletes a directory and all of its contents without asking for confirmation

Posted in Guides, SSH | 1 Comment » twitter-follow facebook-follow rss-follow

Leave a Reply

Your email address will not be published. Required fields are marked *