1) To find out your present working directory:

pwd


2) To change the directory:

cd

Here,

cd: used to navigate into a specified directory on a server.

Example: cd /home (moves to the home folder)


3) To the same directory

cd.


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


4) To move up from one directory

cd ..

Above command will navigate two steps back from the current directory


5) Go to the previous directory

cd –

Above command will navigate to the previous directory.

6) Go to the Home folder

cd ~

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


7) 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 its content.

Example: ls /home.

Will return all content of the folder /home.


9) Show me all files in a directory

ls -a


10) Show contents with file size

ls -h


11) How to see sub-directories recursively

ls -r


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


12) How to see files by file size

ls -is



13) List all folders in the 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


15) Copy a folder with all files

cp -r

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


16) 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


18) 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

21) 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


23) uncompressing folders

unzip

Example: unzip newfolder.zip

24) Compressing folders using tar -czvf

tar -czvf foldername.tar.gz foldername


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

25) 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

27) Delete all files from a directory

rm *


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

Example: rm * folder name


28) 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

30) Change permissions of folder and all files inside

chmod 755 folder name -R

 

¿Fue útil la respuesta? 1 Los Usuarios han Encontrado Esto Útil (1 Votos)