Author: Sahil Suri

Setting up a Basic File server Using simpleHTTPserver

Introduction In this article we will demonstrate a quick and easy method to use your local system as a basic File Server using simpleHTTPserver. The SimpleHTTPServer is a built in module that comes available with the default Python installation on a YUM based system. It is a simple HTTP server that provides standard GET and HEAD request handlers. This allows users to access their data over a web browser allowing anyone in the local area network to access files and folders on from the local system. An advantage with the built-in HTTP server is that you don’t have to install and configure anything. The only thing that you need, is to have Python installed. You can use this to turn any directory in your system into your web server directory.   Prerequisites: Since simpleHTTPserver is a built in python module, the only prerequisite for using it is that your system should have python installed. If you are using any modern Linux distribution then python should be installed on your system as part of the base installation. Let’s verify that we have python installed on our system and check its version. [root@linuxnix ~]# which python /usr/bin/python [root@linuxnix ~]# python -V Python 2.7.5 [root@linuxnix ~]# If you are working on a system that does not have python installed then you could install it manually using your system’s package manager. On Arch...

Read More

Ansible playbook to replace multiple lines in a file

Introduction Commands like sed and awk allow us to harness the power of regular expressions to search for text-based patterns in files and manipulate the matched text as per our requirement. The thing about regular expressions is that they are confusing. To the new Linux user, regular expressions may as well be another language. Although sed and awk are very powerful tools, mastering them is a tedious task for a system administrator. While working on the command line, we frequently interact with various system configuration files and sometimes we need to modify these files to suit our needs. This requirement may span across a fleet of systems as well. Using awk or sed to modify multiline strings in files over ssh could prove to be a handful. Luckily, we can use the replace module in ansible to search for and replace multiple lines between two patterns. In this post, we will share a sample Ansible playbook that replaces multiple lines of text between two patterns. We can view documentation for the replace module using ansible-doc. Given below is a snippet from the output. root@linuxnix ~]# ansible-doc replace > REPLACE (/usr/lib/python3.6/site-packages/ansible/modules/files/replace.py) This module will replace all instances of a pattern within a file. It is up to the user to maintain idempotence by ensuring that the same pattern would never match any replacements made. * This module is maintained by...

Read More

Using Seashells to display terminal output to a web browser

Introduction Having the ability to display your terminal output to a web browser would be a neat feature to have. In this article, we will be discussing a tool named Seashells that does exactly that. Seashells lets you pipe output from command-line programs to the web in real-time, even without installing any new software on your machine.  You can use it to monitor long-running processes that produce continuous output to the console.  You can also use Seashells to share output with friends! Seashells is actually a client to Seashells.io website.  You can either use Seashells.io directly or just install the Seashells client to pipe your output. Some things to keep in mind before getting started: Seashells is still in beta phase and therefore should not be used on production systems. It does not act as a medium to store session data long term. All old sessions (links) will be deleted after a day. Seashells does not have any user account/registration system yet and uses your system’s IP address to identify it and each IP address is limited to 5 concurrent sessions. Using Seashells.io If you wish to use the Seashells.io website directly then you don’t need to install anything on your system. The system you are working with needs to have a connection to the internet and must have the netcat package installed. Along with that the port 1337...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.