Sunday, 24 October 2021

Basic Linux commands

Basic Linux commands and its uses


Following are the basic linux commands, getting familiar with below commands will help beginner in linux administration.

Each command has a extensive manual page for it. We can review the man page using syntax as below, 

#man <command_name>


ssh - connect to another server over network
syntax: ssh server_name

ls - list files and directories.
syntax: ls

pwd - print present working directory 
syntax: pwd

cat - read contents of file without editing the file
syntax: cat file_name

vi - view/edit contents of a file.
syntax: vi file_name

rm - remove / delete a file 
syntax: rm file_name

rmdir - remove / delete directory and its contents
syntax: rmdir directory_name

cp - copy a file from one location to another 
syntax: cp source_file destination_path

cd - change directory to given path
syntax: cd destination_path

grep - find a particular pattern in given file
syntax: grep test filename.txt

yum - Install / remove /update packages/softwares.
syntax: yum install package_name
            yum remove package_name
            yum update package name

Wednesday, 20 October 2021

Squid proxy


Step 1: Install squid using following command.

[root@MailZim ~]# yum install squid

Step 2: Now configure the network of the windows machine in which you want to control the internet using this proxy as shown below.

Step 2.1: Open run command and type inetcpl.cpl

 







Step 2.2: In internet properties select connections tab and select Lan settings.









Step 2.3: Select use a proxy server for your LAN as shown below and type your proxy server ip address here it is 192.168.1.63 and default port is 3128.









Step 3: open Ip properties and remove the dns and gateway. As shown below,









Now check opening google on any of your browser, if it opens then proxy is working perfectly, else check the above steps properly.

Step 4: Add the following highlighted lines in the squid.conf file using following command.

[root@MailZim ~]# vi /etc/squid/squid.conf








Save and exit using Esc :wq

Step 5: Now create a new file using which you are going to block a group of websites, for which  the path is as said in the above highlighted lines, here it is




Step 6: Add the sites which you want to block as shown below, starting with . no www is needed, save and exit after edititing.






Step 7: Now reload the squid proxy service, using the following command,



Step 8: To block sites separately without using any file add the following lines in squid.conf file, as shown below,

acl google dstdomain .google.com

http_access deny google








Step 9 : reload the squid service.

 

 

DONE !!! blocked using proxy squid.