Difference between revisions of "GNULinux tips"

From Karnataka Open Educational Resources
Jump to navigation Jump to search
Line 35: Line 35:
 
7. to save top command results
 
7. to save top command results
 
     $top  shift+w
 
     $top  shift+w
 +
 +
 +
===Free===
 +
 +
purpose: Display amount of free and used memory in the system. Displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the
 +
kernel.
 +
 +
Syntax:  free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V]
 +
 +
 +
Options:
 +
      -b    Display the amount of memory in bytes.
 +
 +
      -c count
 +
              Display the result count times.  Requires the -s option.
 +
 +
      -g    Display the amount of memory in gigabytes.
 +
 +
      -k    Display the amount of memory in kilobytes. This is the default.
 +
 +
      -l    Show detailed low and high memory statistics.
 +
 +
      -m  Display the amount of memory in megabytes.
 +
 +
      -o    Display the output in old format, the only difference being this option will disable the display of the "buffer adjusted" line.
 +
 +
      -s    Continuously display the result delay seconds apart.
 +
 +
      -t    Display a line showing the column totals.
 +
 +
      -V    Display version information.
 +
 +
example:
 +
 +
1. by default free command shows the free and used space of physical and swap memory in kb
 +
    #free
 +
2. switch the free output in bytes/kb/mb/gb
 +
    #free -b
 +
    #free -k
 +
    #free -m
 +
    #free -g
 +
3. To display the totals line at the end, execute free command with -t option
 +
    #free -t
 +
4. Free command displays the output with buffer line normally. we can disable that line in the display by using -o option
 +
    #free -o
 +
5. With -s optoin, we can activate the display of free to show it in every regular intervals for 5 seconds
 +
    #free -s 5

Revision as of 17:43, 28 June 2014

List of Commands

Top

purpose: display Linux tasks.It can display system summary information as well as a list of tasks currently being managed by the Linux kernel

syntax: top -hv | -bcHisS -d -n -p

           -b batchmode
           -c command line/program name
           -d delay time interval
           -h help
           -H threads toggle
           -i idle processes
           -n number of iterations
           -u monitor by user
           -U monitor by user with UID
           -p monitor PID
           -s secure mode operation
           -S cumulative time mode
           -v version

examples: 1. $top

   display information like tasks, memory, cpu, and swap press q to quit

2. to display specific user process

   $top -u username

3. when top is running Press (Shift+O) to Sort field via field letter, for

   example press ‘a‘ letter to sort process with PID (Process ID)

4. Press ‘z‘ option in running top command will display running process

   in color which may help you to identified running process easily

5. Top output keep refreshing until we press ‘q‘. With below command top

   command will automatically exit after 10 number of repetition.
   $top -n 10

6. top -h to obtain top command help

   $top -h

7. to save top command results

   $top  shift+w


Free

purpose: Display amount of free and used memory in the system. Displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

Syntax: free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V]


Options:

      -b    Display the amount of memory in bytes.
      -c count
             Display the result count times.  Requires the -s option.
      -g    Display the amount of memory in gigabytes.
      -k    Display the amount of memory in kilobytes. This is the default.
      -l     Show detailed low and high memory statistics.
      -m   Display the amount of memory in megabytes.
      -o    Display the output in old format, the only difference being this option will disable the display of the "buffer adjusted" line.
      -s    Continuously display the result delay seconds apart.
      -t     Display a line showing the column totals.
      -V    Display version information.

example:

1. by default free command shows the free and used space of physical and swap memory in kb

   #free

2. switch the free output in bytes/kb/mb/gb

   #free -b
   #free -k
   #free -m
   #free -g

3. To display the totals line at the end, execute free command with -t option

   #free -t

4. Free command displays the output with buffer line normally. we can disable that line in the display by using -o option

   #free -o

5. With -s optoin, we can activate the display of free to show it in every regular intervals for 5 seconds

   #free -s 5