Linux (Centos, Ubuntu) common Command Lines

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

CentOS:

Setup VNC

http://wiki.centos.org/HowTos/VNC-Server

Service Status:

service –status-all
service –status-all | grep ntpd
service –status-all | less
service httpd status

List all known services (configured via SysV):

chkconfig –list

List service and their open ports

netstat -tulpn

Turn on / off service

ntsysv
chkconfig service off
chkconfig service on
chkconfig httpd off
chkconfig ntpd on

Memory

free -m

The command will display information about physical memory in MB.

free -m -s 5

The command will activate continuous polling delay at 5 seconds apart, and then display memory status in megabytes on terminal. Any floating point number for delay can be specified.

free -t -m

Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.

vmstat

vmstat reports report virtual memory statistics, which has information about processes, swap, free, buffer and cache memory, paging space, disk IO activity, traps, interrupts, context switches and CPU activity. With vmstat command, administrators can has instantaneous reports on memory usage.

Syntax of vmstat

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

vmstat -[options] [delay count]

Example usage of vmstat

vmstat

The command will display report based on averages since last reboot.

vmstat 5

The command will pool average system resources usage level for a sampling period of 5 seconds at interval of 5 seconds, except the first result that is averages since the last reboot.

top

top command displays dynamic real-time view of the running tasks managed by kernel and system information in Linux system. The memory usage stats by top command include real-time live total, used and free physical memory and swap memory with their buffers and cached memory size respectively.

Syntax and example usage of top

top

Using top is simple, simply type top at command shell, and constantly update stats page will be shown.

ps aux

ps command reports a snapshot on information of the current active processes. Advantage of ps command is that system admins will be able to see where the memory is used. ps will show the percentage of memory resource that is used by each process or task running in the system. With this command, top memory hogging processes can be identified.

Add dhclient during bootup

“dhclient eth0” to /etc/rc.d/rc.local

<code># chkconfig httpd --add # chkconfig httpd on --level 2,3,5</code>

This will enable the apache webserver to automatically start in the run levels 2, 3 and 5. You can check this by running the command:

<code># chkconfig --list httpd</code>

One can also disable the service by using the off flag as shown below:

<code># chkconfig httpd off # chkconfig httpd --del</code>

Use the Ctrl-Alt-F1 shortcut keys to switch to the first console.

To switch back to Desktop mode, use the Ctrl-Alt-F7 shortcut keys.

Leave a Reply

Your email address will not be published. Required fields are marked *