Leeladharan Achar - alias - leelu ~ blogging...hola mi amigos.. The Blog

Leeladharan Achar - leelu Blog. Hola mi amigos!

Handy Commands

Find in all files recursively for a specific string

 find ./ -type f -name "*.*" -exec grep -inH "searchstring" {} \; 

to search in all specific file extensions recursively

 find ./ -type f -name "*.php" -exec grep -inH "searchstring" {} \; 

In a specific directory search for specific file extension and count number of lines in ...

More ...

Compiling PHP5.x on CentOS 7

Download PHP packages

Go to http://php.net site Downloads section and select the PHP-6.X.X version that you want to compile (5.6.12 at time of writing this tutorial), select your nearest mirror and download it then upload to your server using rsync or scp. Another simple solution is typing in your console from your server

# wget -O php-5.6.33.tar.gz http://in1.php.net/get/php-5.6.33.tar.gz/from/this/mirror 

Unpacking ...

More ...

Processing Nginx Logs

Below are list of few commands that can be used in linux to process nginx logs

Processing log file group by HTTP Status Code

awk '{print $11}' access.log | sort | uniq -c | sort -rn 

The $11 is the field in log line, where each field is delimited by a delimiter like (space). In my log files $11 ...

More ...

Python grequests Asynchronous Post Method Example

def get_async_web_response(url, method='GET', params=None, headers=None, encode=False, verify=None, use_verify=False, callback=None): import grequests # make a string with the request type in it: response = None request = None try: if 'POST' == method: if use_verify: request = grequests.post(url, data=params, headers=headers, verify=verify, callback=callback) else: request = grequests.post(url, data=params, headers=headers, callback=callback) else: request = requests.get(url, data=params, headers=headers, callback=callback) if request: response = grequests.send(request, ... 

                        
More ...

CentOS7 Updating OpenSSH To OpenSSH7.5p1

Below are instructions on upgrading openssh6 to openssh7.5p1 on centOS7

Login to RemoteMachine

ssh to the remote machine, where we need to update. Login as root.

Now open another terminal and connect to same remote machine and login as root.

This is to make sure while upgrading if by mistake you get logged out/quit u have another session.

Steps To ...

More ...