Top Most used & Common SSH Commands

REQUIREMENTS TO SSH

  • A working SSH client like Putty (windows) or Terminal
  • A working Linux-based server with SSH enabled
  • A cup of coffee if you wish
  • A computer with Stable Internet connection

NAVIGATING

1. How to move into another directory

Use command below to change directory

# cd [another directory]

example :  move to directory “download”

# cd download

2. How to go to home directory

# cd ~

3. How to go up a directory level

# cd ..

4. How go to last directory you were in

# cd -

5. How to show the full path of the current directory

Use this command to find out where are you currently in.

# pwd

6. How to list files and/or directories in a directory

# ls ( just type ls and hit enter)

7. How to list all files and information

# ls -al

8. How  to list all files ending with certain extension

# ls *.ext

example:

# ls *.php

9. How to list all files and folders with detailed information including file size

# ls -alh

10. How to quit and exit SSH client

# exit

FILE MANAGEMENT

11. How to copy and rename a file

# cp [filename]  [new filename]

example:

# cp banner.jpg  banner728px.jpg

12. How to move and rename file

Use this command to move and rename file

# mv [old filename]  [new filename]

example:

# mv banner.jpg   ads/banner.jpg

13. How to delete / remove a file

# rm [file name]

example:

# rm banner.jpg

14.  How to delete files with certain extension

# rm * .extension

15. How to delete / remove all files in current directory

# rm *

16. How to make directory

# mkdir  [folder name]

example:

# mkdir  [image]

17. How to search for a file starting within current directory

# find . -name [file name]  -print

example:

# find. -name banner.jpg -print

18. How to search for text within a file 

# grep [text] [filename]

example:

# grep  sidebar index.php

19. CHMOD – how to change file permission

# chmod [permission type]  [file/folder name]

example:

chmod 644 config.php

 

 

Leave a Reply

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