jump to navigation

Gathering System Information of your Linux box November 26, 2010

Posted by Tournas Dimitrios in Linux.

There are some “must known” commands on Linux that helps you gather essential system information . For example, you should know how to find the amount of free memory, the amount of available hard drive space, how your hard drive is partitioned, and what processes are running. This article discusses how to retrieve this type of information from your  Linux system using simple commands and a few simple gui- programs.

  • ps
  • top
  • free
  • df   —  fdisk
  • du
  • lspci
  • /proc file system

Lets make a quick review of each command , they can take tens if not hundreds of parameters , so for a detailed description the linux man page must be your first target .

  • ps :The ps aux command displays a list of current system processes, including processes owned by other users. To display the owner of the processes, along with the processes, use the command ps aux. This list is a static list; in other words, it is a snapshot of what was running when you invoked the command. If you want a constantly updated list of running processes, use top as described below. The ps output can be long. To prevent it from scrolling off the screen, you can pipe it through less : ps aux | less You can use the ps command in combination with the grep command to see if a process is running. For example, to determine if Apache is running, use the following command: ps aux | grep -i httpd
  • top : The top command displays currently running processes and important information about them including their memory and CPU usage. The list is both real-time and interactive. Useful interactive commands that you can use with top :
    Command Description
    [Space] Immediately refresh the display
    [h] Display a help screen
    [k] Kill a process. You are prompted for the process ID and the signal to send to it.
    [n] Change the number of processes displayed. You are prompted to enter the number.
    [u] Sort by user.
    [M] Sort by memory usage.
    [P] Sort by CPU usage.

    • free : The free command displays the total amount of physical memory and swap space for the system as well as the amount of memory that is used, free, shared, in kernel buffers, and cached. The command  "free -mshows the same information in megabytes, which are easier to read.
    • df : The df command reports the system’s disk space usage. By default, this utility shows the partition size in 1 kilobyte blocks and the amount of used and available disk space in kilobytes. To view the information in megabytes and gigabytes, use the command df -h. The -h argument stands for human-readable format . In the list of mounted partitions, there is an entry for /dev/shm. This entry represents the system’s virtual memory file system. To display the system’s disk space usage  you can also use fdisk -l
    • du : The du command displays the estimated amount of space being used by files in a directory. If you type du at a shell prompt, the disk usage for each of the subdirectories is displayed in a list. The grand total for the current directory and subdirectories are also shown as the last line in the list. If you do not want to see the totals for all the subdirectories, use the command du -hs to see only the grand total for the directory in human-readable format. Use the du --help command to see more options.
    • lspci :If you are having trouble configuring your hardware or just want to know what hardware is in your system, you can use the LsHw  (Linux hardware tool) application to display the hardware that can be probed. To start the program   type hwbrowser at a shell prompt. It displays your CD-ROM devices, diskette drives, hard drives and their partitions, network devices, pointing devices, system devices, and video cards. Click on the category name in the left menu, and the information is displayed. Read this article that demostrates LsHw .
      You can also use the lspci command to list all PCI devices. Use the command lspci -v for more verbose information or lspci -vv for very verbose output. For example, lspci can be used to determine the manufacturer, model, and memory size of a system’s video card , or determine the network card in your system if you do not know the manufacturer or model number.
    • /proc  filesystem : actually this is a virtual filesystem , it occupy “user – space ”  system memory (RAM) and not  hard drive  space . It mirrors the “soul” of your computer  , and information can be retrieved through  pager utilities like  cat , less , more  . All previous mentioned system information commands ( ps , top , du , free etc… ) , retrieve  information from this virtual file system .See this extensive description of the /proc filesystem.
    • gnome-system-monitor : This is graphical  GNOME process viewer and system monitor with a nice easy-to-use interface, It has some nice features, such as a tree view for process dependencies, icons for processes, the ability to hide processes that you don’t want to see, graphical time histories of CPU/memory/swap usage, the ability to kill/renice processes needing root access, as well as the standard features that you might expect from a process viewer.
  • Advertisements


    No comments yet — be the first.

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )


    Connecting to %s