Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

How to enable disable firewall in Ubuntu

Ubuntu comes with a firewall configuration tool called UFW (Uncomplicated firewall). UFW is a convenient interface for managing firewall rules iptables, and its main goal is to simplify the management of firewall rules or, as the name implies, not complicate. It is highly recommended that you leave the firewall turned on. However, in some situations, such as testing, you may need to stop or disable firewall.



In this article, we will show you how to enable/ disable the UFW firewall. Before starting make sure you are logged in as a user with privileges sudo.

Checking the status of the firewall

To view the current status of the UFW firewall, use the ufw status command:
sudo ufw status
UFW firewall is disabled by default. If you have never activated UFW before, the output will show status as Inactive , Otherwise, if the firewall is turned on, you will see Active

Disabling Firewall

If you disable the firewall due to connectivity issues or have problems configuring the firewall, check out our guide on how to configure the firewall with UFW on Ubuntu. To disable the UFW firewall on your system Ubuntu use the ufw disable command:
sudo ufw disable
The output will look like this:
Firewall stopped and disabled on system startup
The above command will stop and disable the firewall, but will not remove the firewall rules. The next time you turn on the firewall, the same rules will be loaded.

Reset Firewall Rules

If you want to disable the firewall and remove all firewall rules, use the ufw reset command:
sudo ufw reset

Enabling the Firewall

Before turning on the firewall, make sure that the SSH port is open for connection.
To enable the firewall, run:
sudo ufw enable
Most UFW commands are intuitive and easy to remember. For example, ufw status shows the status of the firewall, and ufw disable disables the firewall.

Using CURL with list of urls

Unix command CURL  is used to transfer from to and from any remote server. A basic Curl command to download a file is :

curl http://www.thetechhub.com

In case you to download multiple files with Curl, the syntax is :

xargs curl -I < urllist.txt

where content of urllist.txt is something like below :

http://www.thetechhub.com/file2.txt
http://www.thetechhub.com/file3.txt 
http://www.thetechhub.com/file4.txt

Watermark Resize Or Apply Borders on Pictures In Easy Way - Free Software for Windows Mac Linux

BorderMaker is a free and easy to use software which allows you to easily resize and decorate pictures with borders, text and watermarks.

free-image-enhancenent-software

Features of BorderMaker :

  • BorderMaker allows you bulk resize images from a folder with photos (optionally including subfolders) with ease. You can quickly publish your photos online or upload them to photo sharing sites like Flickr and Picasa.
  • You can also create and apply frames of your own choice.
  • Photos can easily be resized and sharpened with advanced algorithms so they look perfect on the Web.
  • With BorderMaker you can easily place and position text on your photos. Technical data like shutter speed, aperture and ISO rating can be included in the photos.
  • BorderMaker comes with a built-in facility to automatically upload your photos to an FTP location so you can quickly publish them online.
  • You can apply watermarks (logo or text( any thing you want.
  • BorderMaker is available for all popular platforms :  Microsoft Windows, Apple Mac OS X or Linux.

Download BorderMaker – Free Image Enhancement Software

Increase you Internet Speed - Find the best DNS servers based your location

Is your Internet connection giving the best performance?  You might have purchased the best available plan but still not satisfied with the speed. Whichever type of internet connection ( DSL, 3G, ADSL, EDGE, Broadband) you are using, there is always a possibility to tweak it.

Domain Name Server (DNS) is a translator that converts the website name to an IP address. When you click on the hyper-link, or enter an address like www.yahoo.com in your browser, the browser sends the name to DNS servers that help route requests to the proper IP address URL. When you configure the ISP's Internet connection is set up to use your ISP's DNS service. However, you are free to use other alternatives. As such, you can use Open DNS or Google Public DNS etc., to replace your ISP's DNS.

Open DNS offers rich content-filtering options for privacy and security of the family. Google Public DNS has been engineered by Google techies for faster performance and better security. However, because of the complex variables involved, there is no single option can be said to be the best for all. So how do you know the DNS is the fastest for you? you can use the NameBench  tool, which is a free tool to help you find the fastest DNS for. NameBench is available for Mac OS X, Windows, and UNIX with GUI as well as command line interface.

speedup-internet-namebench

NameBench hunts down the fastest DNS servers available for your computer to use. namebench runs a fair and thorough benchmark using your web browser history, tcpdump output, or standardized datasets in order to provide an individualized recommendation. namebench is completely free and does not modify your system in any way.

NameBench-Report

After scanning is complete NameBench displays a through report with recommended  DNS configuration for you system. Before making DNS changes just note down the settings and apply recommendations given by the this free tool. Apply the new settings and enjoy the Increased Speed.

Download namebench from Google Code

How to Zip / Unzip a directory in Linux or Unix Environment

In Linux world Zip command is not as popular as Gzip probably because of its compression where as in Windows we use it more frequently than Gzip. Recently one of my colleague asked for a command to Zip a folder in Linux environment.  After Googling few websites I got below solution :

zip –r   <Folder1.zip> <Folder1>

Here -r parameter recursively compresses the folder passed as parameter. 

This command will result compressed Folder1 with all its contents recursively in Folder1.zip file. Here one thing I have noticed that Zip command reports error while Zipping Folders with name containing special characters like _ underscore or  hyphens – or . dots. Not sure why it happened, but I don’t have solution for it now.

If you want to reverse the zipped file back to folder you can use below command :

unzip Folder1.zip -d /temp

This command will result Folder1.zip to be extracted under temp path as Folder1 directory.

MD5 Checksum on Linux - How to ?

For people who don’t know what is MD5? and why we use it?

As per Wikipedia

The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value. Specified in RFC 1321, MD5 has been employed in a wide variety of security applications, and is also commonly used to check data integrity.

To calculate MD5 hash you can use md5sum command something like below.

MD5 Checksum

md5sum filename

This command returns 128 bit checksum string which you can further compare to validate the authenticity of the file/ software you have downloaded.

Unix /Linux Command to display first n lines and last n lines of a files

If you are new to dark world of penguins where command line matters a lot, these two commands are going to be very handy to you

Read first n lines from a files :

head –10  install.log

This command will display first 10 lines of install.log files. In a similar manner, if you want to read a file from bottom, you can use tail command.

Read last n lines from a files

tail –5 install.log

tail command will output 5 lines from the bottom of install.log file.

Both commands can also be used at the same time to get some more interesting output. Lets say, I want to read 3 lines starting from 100. This can be interpreted as below command sequence

head –100 | nl | tail –3

This will result output similar in the stated problem. nl parameter in the command is used to print lines numbers, this can be omitted if you don’t want them.