Posts

Showing posts from March, 2012

System Command on Linux

# Monitor the system: pstree Processes and parent-child relationships top Show top processes iostat Report CPU statistics and input/output statistics for devices and partitions. ps -auxw process status uname -a print system information cat /proc/version Display Linux kernel version in use. cat /etc/redhat-release Display Red Hat Linux Release. (also  /etc/issue ) uptime Tell how long the system has been running. Also number of users and system's load average. w Show who is logged on and what they are doing. /sbin/lsmod List all currently loaded kernel modules. Same as  cat /proc/modules /sbin/runlevel Displays the system's current runlevel. hostname Displays/changes the system's node name. (Must also manually change hostname setting in  /etc/sysconfig/network . Command will change entry in  /etc/hosts ) service Red Hat/Fedora command to display status of system services. Example:  service --status-all Help:  service --help # Process management : The basic L

Sample Data Structure In C

////////////////////STACK//////////////////// #include <stdio.h> #include<ctype.h> #include <cstdlib> # define MAXSIZE 200 int STACK[MAXSIZE]; int top,CHOISE=1,i; void push(int); int pop(); void display(); void main() {     int num;     while(CHOISE==1){         printf("\n       MAIN MENU\n\tPRESS 1 to Add element to stack\n\tPRESS 2 to Delete element from the stack\n\tPRESS 3 to Display STACK\n\tPRESS 9 to EXIT from the STACK");         scanf("%d",&CHOISE);         switch(CHOISE){         case 1:             printf("Enter Number To Insert In To Stack\n");             scanf("%d",&num);             push(num);             printf("NOW TOP VALUE ON STACK IS:::%d\n",STACK[top]);             break;         case 2:             i=pop();             printf("Value returned from pop function is %d",i);             break;         case 3:             display();break;         case 9:             exit(0);      

Linux Basic Commands

Listing and Moving Files and Directories ls  -  LiSt files - "-a" lists all files, "-l" give a long DOS-dir-like output - example: "ls -la" cp  -  CoPy - copy file(s) from one location to another - example: "cp *.c another_directory/" mv  -  MoVe - move file(s) from one location to another, same as cp except it removes files afterwards rm  -  ReMove - delete files - example: "rm *.o" cd  -  Change Directory - example "cd /tmp" mkdir, rmdir  -  MaKe DIRectory and ReMove DIRectory ln  -  LiNk - make a link to a file - two types of links, normal and symbolic - example: "ln -s original newlink" Special Directories  -  '.' is current, '..' is current's parent, '~' is home, and '/' is the root (or top) of all directories Redirection and Shell Stuff |  - Pipe, one of UNIX's best features, used to send output from one program to be input to another - example: &quo

Telnet Configuration on Linux

Telnet  (teletype network) is a network protocol used on the Internet or local area networks to provide a bidirectional interactive communications facility. Typically, telnet provides access to a command-line interface on a remote host via a virtual terminal connection which consists of an 8-bit byte oriented data connection over the Transmission Control Protocol (TCP). Configuration: Telnet is a xinetd based services. HOW TO CONFIGURE TELNET IN LINUX SYSTEM You can use yum installation or rpm installation process to install the telnet software.  To check Telnet is already installed on your system or not use the following command. rpm -qa|grep telnet For Yum installation use the following command yum install telnet-server For rpm installation use the following command rpm -ivh telnet-server.x.x.rpm                           (x means the version of software) The above command will install telnet  Then to activate the Telnet Server Edit the file  /etc/xinetd.d/t

User Management and Other command on Linux

# Creating a new system local user account: The three most common methods of defining a Linux user and authenticating their logins are: Local user authenticated locally with the password files  /etc/passwd  and  /etc/shadow Network authentication using an LDAP authentication server NIS authentication server. To specify an NIS authentication server, use  /etc/ypconf  which contains the line:  ypserver  ip.address.of.server . Find with  ypwhich The following describes creating a local user: Command Line Method:   useradd user_name  : Add a user to the system. System uses configuration and security defaults set in  /etc/default/useradd  and  /etc/login.defs useradd -m  user_name  : Add a user to the system and create a home directory populated with default files from  /etc/skel/ useradd -m  user_name  -G floppy  : Will grant the user read/write privileges to the floppy (/dev/fd0) upon creation of user by adding user to group floppy in addition to the default group specifi