Posts

Showing posts with the label tutorial

Magic SysRq Tutorial - What, Kernel Configuation, Use, Commands

What is SysRq? SysRq is the magical key comibnation when you hit, kernel will respond regardless of whatever else it is doing, unless it is completely locked up. Kernel Configuration to Enable SysRq? During Linux Kernel Compilation: CONFIG_MAGIC_SYSRQ = 'y' While running Linux: Kernel Command Line Parameter: "sysrq_always_enabled" echo "number" > /proc/sys/kernel/sysrq 0 - Disable sysrq completely 1 - Enable all functions of sysrq > 1 - Bitmask of allowed sysrq functions How to use SysRq? If X86: Press Key Combo: Alt + SysRq + <Command Key>. If you don't find 'SysRq' on your keyboard , use 'PrtScr', then the key combo becomes: Alt + PrtScr + <Command Key> On All other machines ( This will be useful when there is no keyboard attached and you have a serial console) : echo <command key> > /proc/sysrq-trigger E.g. echo b > /proc/sysrq-trigger to reboot the system echo g > /p...

grep command tutorial

What is grep? grep stands for G lobally search a R egular E xpression and P rint. Created by Ken Thompson, the author of B Programming Language. It is a command-line utility to search a particular string in the files. Usage 1: Search a particular word in file To search a particular word in a file. $ grep <word> <file to search> Eg. grep hello words.txt The above command searches for word "hello" in the file "words.txt" and prints the matching lines in which the word "hello" is present in the file . The above command by default performs case sensitive search, this means if there is "Hello" present in the words.txt file it won't be detected by the search. Usage 2: Case Insensitive word search in file $grep -i <word> <file to search> Eg: grep -i hello words.txt The above command performs case insensitive search and gives you "hello"  "Hello" or other variants in the search. Usa...

cron tutorial 2 logging

Image
We have seen in our first part of cron tutorial how to schedule a particular job at a specified time. In this part, we will see how we can perform cron logging By default the cron jobs are logged in /var/log/syslog file If you want the cron logs to store it in a separate log file ( /var/log/cron.log) . Uncomment the line that starts with #cron*. /etc/rsyslog.d/50-default.conf If there is no such file present in /etc/rsyslog.d, create 50-default.conf file and add the following entry cron*.    /var/log/cron.log Restart rsyslog by running the following command : sudo service rsyslog restart Now all the cron logs will be stored in the /var/log/cron.log file You can also redirect the output of individual cronjobs to their own log files . */1 * * * * root /home/jamal/test.sh >> /var/log/test.log If you want to log both standard output as well as errors then use the following syntax */1 * * * * root /home/jamal/test.sh >> /var/log/test.log...

cron tutorial

Image
What is cron? cron is a daemon available in UNIX based systems which runs in background and automatically executes scripts or commands  at the specified time mentioned by the user. Example Scenarios where cron can be useful Connecting to the Internet and downloading E-Mail Cleaning up personal temporary directory How to check whether cron is running or not On  most of the Linux distributions, cron is already installed and is started by the startup scripts. jamal@jamal-Lenovo-G580:~$ ps ax| grep "cron"  1356 ?        Ss     0:00 cron  3793 pts/0    S+     0:00 grep --color=auto cron The top line shows that the cron is running and the bottom is the one we have searched How to schedule a job in cron There are different ways to achieve this: 1. User specific 2. System Level System Level: In the /etc, there are subdirectories called cron.hourly, cron.monthly, cron.weekly...

Corflags tool Tutorial

Corflags tools is used to know whether your .exe or .dll is meant to run only on a specific platform or under WOW64. This tool will be very useful if you are planning to run the application on 32 and 64 bit machines. This tool is automatically installed with Visual Studio. Open Visual Studio Command Prompt. Syntax: corflags AssemblyName Eg: Corflags.exe AssemblyName.dll Some of the fields present in the output are: Version : .NET Version that the binary was built with CLR Header: 2.0 means either 1.1 or 1.1 while 2.5 means 2.0 PE &32 Bit: The platform this binary was compiled to run with: Any CPU: PE = PE32 and 32BIT = 0 X86 : PE = PE32 and 32BIT = 1 x64: PE = PE32+ and 32BIT = 0 ILONLY: If the assembly contains unmanaged code the value is 0 else 1. Signed: Whether this assembly was signed using a stronger key. References: 1. http://blogs.msdn.com/b/gauravseth/archive/2006/03/07/545104.aspx

Diskpart Utility Tutorial

Diskpart:  Diskpart utility is a command line utility that allows you to manage and configure your hard disks, volumes, or partitions How to format the pendrive using diskpart utility if it is not getting listed in the Windows Explorer? Steps to be followed Open command prompt in administrator mode type "diskpart" type "list disk" which displays all disks present on the computer type "select disk 1", if you want to the select the second disk, you can choose any number type "clean", which will remove all the partition or volume formatting from the disk with focus type "create partition primary", which creates a primary partition on the current basic disk. after you create the partition, the focus automatically shifts to the new partition type "active", which marks the partition as active type "format FS=NTFS LABEL="ANY NAME" QUICK", performs a quick format type "assign" which ...

MFC Tutorial Part 1

Simple.h : #include <afxwin.h> class CSimpleApp:public CWinApp { public: BOOL InitInstance(void); }; Simple.cpp : #include "Simple.h" BOOL CSimpleApp::InitInstance(void) { return TRUE; } CSimpleApp Application;

msinfo32 utility tutorial

msinfo stands for Microsoft System Information . You can start msinfo32 in two ways: Method 1: Start -> All Programs -> Accessories -> System Tools -> System Information Method 2: Start -> Run -> Type msinfo32 -> Click OK Location:  C:\Windows\System32\msinfo32.exe What you can do with msinfo32 utility? --> Know what device drivers are loaded in computer. --> Devices present in the system --> Diagnose computer issues. --> BIOS Version --> Windows Version --> OEM System Information (Manufacturer, Model,type) --> Type of CPU --> Amount of Memory --> User Name (Format: DomainName\UserName) --> Time Zone --> Boot Device --> Locale This information can be saved into a file (Format *,nfo) which can be opened only by msinfo utility. In order to save the information Click File -> Save and enter the name.

Dumpbin Utility Tutorial

dumpbin is a program in Visual Studio Tools that helps you to display information in binary fi le. By using dumpbin we can check whether a dll is build for  x86 or x64. In order to run it Go to Start -> Microsoft Visual Studio2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt. Type dumpbin and it will list all the commands present. To see all the methods exported by a particular DLL, change the directory where the DLL is present and type the following command: dumpbin /exports TestStreamDrv.dll To check whether a dll is build for x86 or x64 and type the following command: dumpbin /headers TestStreamDrv.dll It displays a lot of information. Look for Machine which is present in FILE HEADER VALUES . This determines whether the DLL is present for x86 or x64. References: http://thompsonng.blogspot.com/2011/03/dumpbin-checking-your-application.html