Saturday, May 31, 2008

How do you get current CPU utilization, memory and disk space usage in Linux/Unix?

What are the commands?

  1. quota

    All are allocated a certain amount of disk space on the file system for their personal files, usually about 100Mb. If you go over your quota, you are given 7 days to remove excess files.

    To check your current quota and how much of it you have used, type

    % quota -v

    df

    The df command reports on the space left on the file system. For example, to find out how much space is left on the fileserver, type

    % df .

    du

    The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files. In your home-directory, type

    % du

  2. use prstat
  3. For CPU utilization "top" can be used.
thanks to http://www.geekinterview.com/question_details/61146

Is ‘du’ a command? If so, what is its use?

Yes, it stands for ‘disk usage’. With the help of this command you can find the disk capacity and free space of the disk. "du" reports the disk usage by each sub-dir under the current directory.

some of the options for "du" are :

  • du -k : returns the disk usage in KBs

  • du -k : gives the disk usage by direcotry and all its sub-directories in KBs.

"du" does not show the free disk space. Use "df" for this.

Is it possible to create new a file system in UNIX?

  1. Yes, mkfs is used to create a new file system.

    mkfs -t filesystem device name.
    for e.g
    mkfs -f ext3 /dev/hda2

What is relative path and absolute path?

  1. Absolute path : Exact path from root directory.
    Relative path : Relative to the current path.
  2. absolute path is from home directory to user directory..

    but

    relative path is from present working directory to user directory.

    Ex:

    Say, your current working directory is /home/tst

    If there is sub-dir called scripts here, then

    the absolute path for the sub-dir is /home/rama/scripts

    and

    relative path is scripts or ./scripts (relative to /home/rama)

What is the importance of Cascade in CSS?

  1. One doesn't have to declare repeating styles for the child elements. E.g. if body has a font-name style set to Arial, by default all the elements in the HTML document will inherit this property, unless defined separately.

What are the types of CSS rules?

  1. There are three types of CSS rules. They are :
    • HTML Selector
    • Class
    • ID

What is CLASS selector?

  1. Using CLASS selectors in CSS one can assign style information to all elements. Class selectors name in CSS is preceded by full stop.
  2. The class selectors which can be applied multiple times to different element within a page to format content.

What are Inline elements in CSS?

  1. If a user wants to set a particular style for a particular element this can be done using Inline styles by making use of the STYLE attribute. The STYLE attribute is different from style tag. Thus a inline style is applied only to a particular element.

What is external Style Sheet?

  1. External Style sheet is used to control the style of a multiple web pages. By this way we can create the style sheet outside the JSP page and include it in the head section of the jsp.

    link rel="stylesheet" type="text/css" href="style.css"

    An external style sheet (CSS) is perfect - when the same style / format / look n feel is required on numerous pages. With an external style sheet, the webmaster can change the look of the entire site - by changing one file.
  2. External Style Sheet tag is place after the heading tag. this tag purpose is the we can mention the path of the style sheet.

What is the need for CSS?

  • CSS is called as Cascading Style Sheets. This is used to enhance the features of web pages like formatting styles say bold, font size and so on and there by increase the visual appearance of web pages. These are specified inside an HTML tag. The use of CSS reduces time and enhances the web page design. With CSS it is possible to define layout of HTML documents like font, color, margin, line, height, width, images and so on. And another vital factor is CSS is supported by almost all web browsers and thus making it compatible for usage. With HTML one just defines the layout but with CSS added to it only enhances the design of document and thus catches the visual appearance and makes it easier to use for users. Thus the major difference between HTML and CSS will give the need for CSS in short. It is as follows. HTML is a structured content but CSS is used for formatting the structured content. The main need for CSS comes into picture when there was a need for a tool that is supported by all browsers which was achieved by CSS. Not only this in CSS the presentation style of document is separated ort excluded from the content of the document and thus making it much easier for users to understand and there by making it easier for maintenance. Thus in short the major advantages of CSS which led to the need for CSS are given below:

    • Supported by all browsers
    • Many sophisticated techniques available to achieve the formatting
    • Presentation style of document separated from content
    • Easier to Maintain the site
    • Very structured formatted layout achieved.
  • css used to add styles to existing html elements.if you like to change any color or size for any html element ,you can change in one place where css is defined, it will replicate changes to all corresponding html elements instead of changing to all the places.
  • The major use of CSS is to reduce redundancy and increase usability. In other words, you only need one style sheet to standardize the look and feel of the website.
  • If we using CSS for styling a Site insted of Instyle , in a single edit we can change the look and feel of the site. if our pages number is more CSS is necessary
  • CSS helps in faster downloading of the pages. Main benefit is that the styles need to be downloaded only once, on the first page the user visits. The style sheet goes into the cache, and thus need not be downloaded again and again for other pages that use that same cached style sheet.

    Disadvantages of separating style and content is that complex layouts can be difficult to create. for users inexperienced in writing CSS, complex layouts can be difficult to recreate. Additionally, many browsers render certain CSS rules differently than others, meaning that a layout which looks correct in one browser may look quite different in another.