Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Saturday, July 21, 2018

Finding multiple folders in Linux with single command

Finding multiple folders with single commend on Linux is not a big deal.

I wanna know all temp / tmp and cache folders in websites, that are configured with WHM to exclude from the backup. Here is the command for that,


find /home/*/public_html \( -type d -iname "cache" -or -iname "tmp" -or -iname "temp" \)

To know size of these folders,

find /home/*/public_html \( -type d -iname "cache" -or -iname "tmp" -or -iname "temp" \) -exec du -sh {} \;

Thursday, June 18, 2015

Clearing RAM cache and SWAP memory in Linux

If your server get hanged, RAM cache is one of the major reason,. It happens frequently on web server when we are under attack or web developer dosen't consider about performance of application. Miss configuration of servers like mysql and apache is one of the main reason.

We can see ram cache amount on htop, which is user friendly monitoring tool for Linux servers. Because of it we may loss some connections and it's interaction with server. We can do this by our own risk.

What is RAM cache ?

It is a portion of memory made of high-speed static RAM (SRAM) instead of the slower and cheaper dynamic RAM (DRAM) used for main memory. Memory caching is effective because most programs access the same data or instructions over and over.

To clear cache :

free -m && sync && echo 3 > /proc/sys/vm/drop_caches && free -m

To clear pagecache change value of echo to 1 on about commend, to clear dentries and inodes change value of echo to 2 on about commend, echo 3 will clear all of three pagecache, dentries and inodes.

To clear swap:

Up-to I know that there is no straight way to this, But we can do it by disable and enable the swap, We can do this by following command,

To turn off : swapoff -a
To turn on : swapon -a 

Wednesday, May 6, 2015

Finding malware codes on web pages

It is beginners trick, not advised for administrators.

Lot's of tools are available on Linux to find the malware codes injected on server. But most of them not detect the page with url encoded. Because it's php functionality. Mostly of this happens when developer or administrator not aware problem when we providing 777 permissions to pages on web servers. In these cases simple java-script injection will make server to get down.

We can disable this function, urldecode but unfortunately it's bad idea on shared hosting and most of frameworks using url encode and decode. In this case, we can do some manual work for figure-out codes by following commend.

find . -iname '*php' | xargs grep 'urldecode' -sl

This will list the files that have urldecode. We can check page and remove code.

Tuesday, February 3, 2015

Query to find size of MySQL DB

When we are using shared hosting server with Windows or Linux, without any control panel software, It's little bit hard to find user's disk usage on mysql.

In this case we can use  following command on mysql to get size of database.

SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP  BY table_schema;

Saturday, October 25, 2014

Copy files with original timestamp in Linux commandline

If you move files on Linux with command mv, time-stamp won't be change, But if you copy with command cp, it'll take current time for time-stamp. If we wanna get original time-stamp, you can use following command on Linux,

cp -R -u -p /source /destination

What is time-stamp ?

When we create or modify file / directory, it'll store creation and / or modification date and time on file / directory properties. Which is called time-stamp.





Friday, October 24, 2014

Setting up default permissions to Files and Directories

Most of the Linux beginners / Linux - Level 1 administrator do this funny thing. Setting up 777 permission to files and folders.

With, chmod -R 777 folder_name

Some times it'll help to destroy the server easily by hackers.

Let's come to topic, How to setup default / basic level permission to files and folders.

chmod -R 777 folder_name will give you files and folders with read, write and execute permission, Mostly we no need of execute permission for files.

If we try to change it as chmod -R 666 folder_name, we are not able to open directory.

If we have 100s of sub directory with 1000 of files in each directory,... oh my god.... How do we fix it worst thing.... Here is command.

first open your parent directory, with
cd parent_directory_name

And run following commands,

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Working: On first command It'll check type of the object whether it is file or directory, if it is directory it'll change permission to 755, else leave. On second same condition, if it is file then change permission to 644 else leave with same,

Copy mysql database table by query / command line

We can find lot of solutions to make copy of table.
Here is one of the simple solution which I got while google.

Copy table with in a Database

use databasename;

CREATE TABLE exampletable_copy LIKE exampletable;
INSERT exampletable_copy SELECT * FROM exampletable; 


Copy table from Database-1 to Database-2

use databasename2;

CREATE TABLE exampletable_copy LIKE exampletable.databasename1;
INSERT exampletable_copy SELECT * FROM exampletable.databasename1


Hint:
First query used to create table with structure of original table.
Second query used to copy data from table to table-copy.

Monday, June 10, 2013

Adobe Flash Player Standalone Offline Full Installer for Windows


Good thing in these links are up to date automatically by Adobe. 
So no need to bother about whether it's updated or not.

Internet Explorer

All other browsers Firefox, Chrome etc.

Tuesday, February 21, 2012

SAMBA client in Linux with GUI

We can connect samba server with GUI mode as like windows machine in Linux.

Run Application will be used to access samba server in Linux with GUI.

Alt+F2 used to open Run Application window.

It looks as follows.

run application

Just type smb://{samba server address} and hit Enter.

Ex.

smb://10.1.1.1

This will open your samba share window. Give password if it asks.

Monday, January 30, 2012

Play NFS (Need For Speed) or other Games on Full Screen in Laptop with Windows 7

Now a days most of people playing NFS serious (NFS Most Wanted , NFS Carbon etc.) in Laptop.

We are facing the problem that NFS game does not play in full screen mode. It have some black bar at both right and left side.

We can fix it with simple steps, For this your video driver should be installed with it's "Graphics & Media Control Panel" application.

Here i have explained it with screen shot. It'll be mostly same for Intel boards. Settings for other video drivers may differ. You may need to search for it in their graphics control panel.


Step 1 :

Click aero button at right bottom corner for show available notifications and running process. There is Graphics & Media Control Panel Icon.
If it is not avaliable there, you can get it from "Windows Control Panel".
It'll open your "Graphics & Media Control Panel".
 


Step 2 :

Click Graphics & Media Control Panel icon and choose Graphics Properties...


Step 3:

Under Intel Graphics and Media Control Panel,
Display -> General Settings -> Scaling -> Scale Full Screen


That all, Then apply and ok.

Here after your can play any of your favourite game as full screen in your Laptop and Desktop.

Saturday, June 11, 2011

Windows XP Hidden apps

Following comments are execute throw run command box,

  1. Character Map = charmap.exe (Useful for finding characters)
  2. Disk Cleanup = cleanmgr.exe (Clean temp / compressed files)
  3. Clipboard Viewer = clipbrd.exe (Views contents of clipboard)
  4. Dr Watson = drwtsn32.exe (Troubleshooting tool for windows xp)
  5. DirectX diagnosis = dxdiag.exe (Diagnose & test DirectX, video & sound cards)
  6. Private character editor = eudcedit.exe (allows creation or modification of characters)
  7. IExpress Wizard = iexpress.exe (Create the self-extracting / self-installing packages for windows)
  8. Microsoft Synchronization Manager = mobsync.exe (appears to allow synchronization of files on the network for when working offline. Apparently undocumented)
  9. Windows Media Player 5.1 = mplay32.exe (Retro version of Media Player)
  10. ODBC Data Source Administrator = odbcad32.exe (Database connectivity)
  11. Object Packager = packager.exe (to do with packaging objects for insertion in files, appears to have comprehensive help files)
  12. System Monitor = perfmon.exe (To know about PC performance)
  13. Program Manager = progman.exe (Legacy windows 3.x desktop shell) // didn't work for me.
  14. Remote Access phone book = rasphone.exe (documentation is virtually non-existant)
  15. Registry Editor = regedt32.exe or regedit.exe (For edit windows registry)
  16. Network shared folder wizard = shrpubw.exe (creates shared folders on network)
  17. File siganture verification tool = sigverif.exe
  18. Volume Control = sndvol32.exe
  19. System Configuration Editor = sysedit.exe (for edit System.ini & Win.ini)
  20. Syskey = syskey.exe (Secures XP Account database - use with care, it's virtually undocumented but it appears to encrypt all passwords)
  21. Microsoft Telnet Client = telnet.exe
  22. Driver Verifier Manager = verifier.exe (Utility for monitoring the actions of drivers)
  23. windows for Workgroups Chat = winchat.exe (chat sessions over a LAN)
  24. System configuration = msconfig.exe (can use to control starup programs)
  25. gpedit.msc used to manage group policies, and permissions..!

Saturday, May 14, 2011

Clear Recent Documents in OpenOffice.org with History Manager for Linux

Here the steps for clearing recent documents list in OpenOffice.org

History Manager is the add-on for OpenOffice.org. We are using this add-on for clearing recent documents.

Step  1 : Download the add-on from here.
Step  2 : Save it anywhere you like.
Step  3 : Open the application OpenOffice.org writer
Step  4 : Go to tools -> Extension Manager
Step  5 : It'll open new window, here click "add" button and choose the file which you downloaded at 1st step.
Step  6 : It may or may not ask for "Only for me" or "For all user". Choose your wish.
Step  7 : It shows agreement, scroll down and click accept button.
Step  8 : Restart the OpenOffice.org writer.
Step  9 : Go to tools -> Add-on -> History Manager
Step 10: Allocate your history size and click OK, If want to clear history, set "0" and click OK

Saturday, January 29, 2011

Download Mobile applications to your PC

We can't download some mobile applications to pc,

ex : gmail


Why want to download those applications to PC ,
  1. We can access applications from memory card
  2. If you move applications from phone memory to memory card also it'll work, but once u removed your memory card, it won't work.


Here the trick to download those type of applications to PC...

It's very simple.

Step 1 : First download that application to your mobile by gprs,
Step 2 : Move downloaded application from phone memory to memory card.
Step 3 : By use of data cable or blue tooth, open your memory card as mass storage in pc.
Step 4 : Open application location, there you can find .jad and .jar file (ex: application_name.jad)
Step 5 : Open .jad file using text editor, there you can find a location of .jar on internet server.
Step 6 : Before URL you can find "MIDlet-Jar-URL:"
Step 7 : Copy that link location and past it to your pc browser, and hit enter.
Step 8 : Download will start, then you can copy that file to mobile and can use. :-)


Steps for download GMail mobile application from m.google.com

Go to m.gmail.com and use faster gmail, download gmail application to mobile ( mostly it store in phone memory).

Move phone memory to memory card.

Copy .jad file from mobile memory to pc

Open  .jad on notepad. find line,
MIDlet-Jar-URL: http://m.google.com/mail/download/binaries/L1/2.0.6/mail_n60-3.jar
Underlined link may be change, Copy that line to browser and download file.

Copy to memory card and use.

* U can use this link for download .jar file, But there is chance, that application not to work. So do all steps.

Drawback : Can't update application.
My Mobile : Nokia 6303i classic

Monday, August 30, 2010

Hide partition drive from My Computer in Windows

Group Policy is a feature of the Microsoft Windows NT family of operating systems. Group Policy is a set of rules which control the working environment of user accounts and computer accounts. Group Policy provides the centralized management and configuration of operating systems, applications and users' settings in an Active Directory environment. In other words, Group Policy in part controls what users can and can't do on a computer system. Although Group Policy is more often seen in use for enterprise environments, it is also common in schools, smaller businesses and other kinds of smaller organizations. Group Policy is often used to restrict certain actions that may pose potential security risks, for example: to block access to the Task Manager, restrict access to certain folders, disable the downloading of executable files and so on.

Here we using group policy for hide Hide partition drive from My Computer in Windows. ( Here i using windows XP )

Step 1 : In run commend type gpedit.msc


Step 2 : Hit Enter, You'll get following window, This is group policy editor window,


Step 3 : Choose User Configuration, In Tree under user configuration choose Administrative Templates,


Step 4 : Under Administrative Templates, click windows Components and then Windows Explorer. Now in the right side of the window we ca find a text , Hide these specific drives in My Computer



Step 5 : Now double click it, You'll get a window like as follow. Here, First you want to click Enabled radio button, Then want to choose drive want to hide.



That's all. Now click ok and check you My Computer.

Windows Event Log Viewer

In Windows XP, an event is any significant occurrence in the system or in a program that requires users to be notified, or an entry added to a log. The Event Log Service records application, security, and system events in Event Viewer. With the event logs in Event Viewer, you can obtain information about your hardware, software, and system components, and monitor security events on a local or remote computer. Event logs can help you identify and diagnose the source of current system problems, or help you predict potential system problems.

Steps to go Event Viewer :

Step 1 : Go to run and in field type ' eventvwr ' ( without quotes )


Step 2 : You'll get following window, In this log are grouped as 5 categries ,

  • The application log is where applications / programs log their events. For example, when your virus scanner encounters a problem, it could bring this to your attention through the application log. The developers of the program are responsible for the type of events that are logged here. THAT is where you can often find VERY useful information about things that go wrong behind the curtains. Things that can dramatically slow down your pc.

  • The security log is used to bring valid and invalid logon attempts to your attention. Also file access, creation and deletion of files can be logged here. You need to have an account with administrative privileges to enable, use and specify which events are logged in the security log.

  • The system log , where you will find events logged by Windows system components. Can also reveal some VERY interesting troubleshooting information about your system.
Microsoft Office Diagnostics and Microsoft Office Sessions are used for Log MS-Office activities,

Step 3 : If you click the respective tree item in left you'll get log at right side of window,



About Events:

There are basically three types of events : information, warning and error.

  • Informative events : There's no need to worry about it. they just, well, inform you that something has happened, e.g. a driver has loaded or a service has started.

  • Warnings : Not critical. May be an indication of future problems, for instance when disk space is running low.

  • Errors : You should try to get rid of those. They indicate a significant problem, such as the failure of a critical task. For example when a system service fails to start. These can cause loss of data or functionality.


source : http://www.windows-help-central.com/windows-xp-event-log.html

Friday, February 12, 2010

Clear cache in Linux Server

If you running Proxy Server, Mostly it'll store frequently visiting sits content.

It's one of the best feature for fast browsing, But some few cases it not good.

Here a commend for clear cache files from server,

But it not useful at all conditions,

Step 1 : Open terminal and type following

root@localhost~] # echo 3 > /proc/sys/vm/drop_caches

Step 2 : Hit Enter


That's all.


Note : It's not give solution for all problem related with it.