Basic commands for Putty (SHELL)

shape
shape
shape
shape
shape
shape
shape
shape

PuTTy is used on Windows systems to connect to a Unix machine, for example. PuTTy opens a window. So anything you type in the window is sent to the Unix machine and everything the Unix machine sends back is displayed in that window. Below are some basic commands for this useful tool:

Navigating directories:

cd

Command used to browse directories. For example:

cd folder1/folder2

The above command takes you to folder 2.

 

Displays content:

ls

Shows the contents of the folder you are in.

 

Creating files and folders:

touch file.html

Use the “touch” command to create files.

rm file.html

Use the “rm” command to remove a file.

mkdir myfolder

Create a new folder.

rmdir myfolder

Remove a folder. Remember that the paste must be clean.

mv folder1/file.html folder2/file.html

Used to move a file or rename it. To rename, simply change the name of the file after typing in the name of the destination directory.

 

Zipping and backing up:

zip -r foo.zip foo/

It compresses the “foo” folder and all its contents into a file with a ‘.zip’ extension called ‘foo.zip’.

zip foo.zip foo.html

Compresses the ‘foo.html’ file into a ‘.zip’ file called ‘foo.zip’.

 

Changing file and folder permissions (CHMOD):

chmod 755 file.html

Change the file permission. The folder permission is changed in the same way.

chmod -r 755 folder

Changes the permission of the folder and all the files and subfolders in it.

 

Meaning of the values for CHMOD:

■700: Only the owner can read.

■755: Everyone can read but not write.

■775: Only the group can read and write.

■770: No one except the group can read it.

■666: Everyone can read and write.

■777: Everyone can read, write and execute.

chown user:myself file.html

Change the owner of the file “file.html” to the user called ‘myself’.

 

Leave a Reply

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

Latest news

Latest news directly from our blog.