EVERY LINUX_ADMIN-COMMANDS TO BE KNOW



Hello Friends,
            in todays article i am gonna cover the most used 16 linux commands,every linux admin should know it.in the whole article i just show the uses of all the commands and their additional attributes too.

so lets start it..

#1: top - Process Activity Command 

The top program provides a dynamic real-time view of a running system i.e. actual 
process activity. By default, it displays the most CPU-intensive tasks running on the 
server and updates the list every five seconds. 





HotKey     Usage 
t       Displays summary information off and on. 
m       Displays memory information off and on. 
A       Sorts the display by top consumers of various system resources. Useful for quick 
i       dentification of performance-hungry tasks on a system. 
f       Enters an interactive configuration screen for top. Helpful for setting up top for a 
        specific task. 
o       Enables you to interactively select the ordering within top. 
r       Issues renice command. 
k       Issues kill command. 
z       Turn on or off color/mono 


#2: vmstat - System Activity, Hardware and Syste
Information 
The command vmstat reports information about processes, memory, paging, block IO, 
traps, and cpu activity. 





Display Memory Utilization Slabinfo 
# vmstat 3 










Display Memory Utilization Slabinfo 
# vmstat -m 
      or
if you are not an root user you have to make your self as root user by adding 'sudo'
keyword in the command.
#sudo vmstat -m 




Get Information About Active / Inactive Memory Pages 
# vmstat -a 






#3: w - Find Out Who Is Logged on And What They Are Doing 
'w' command displays information about the users currently on the machine, and their 
processes. 
# w username
like in mine case user name is 'ubutu' 
# w ubuntu 


#4: uptime - Tell How Long The System Has Been Running 
The uptime command can be used to see how long the server has been running. The 
current time, how long the system has been running, how many users are currently 
logged on, and the system load averages for the past 1, 5, and 15 minutes. 
# uptime 


1 can be considered as optimal load value. The load can change from system to system. 
For a single CPU system 1 - 3 and SMP systems 6-10 load value might be acceptable. 

#5: ps - Displays The Processes 
ps command will report a snapshot of the current processes. To select all processes use 
the -A or -e option: 
# ps -A 




Show Long Format Output 
# ps -Al 
To turn on extra full mode (it will show command line arguments passed to process): 
# ps -AlF 
To See Threads ( LWP and NLWP) 
# ps -AlFH 
To See Threads After Processes 
# ps -AlLm 
Print All Process On The Server 
# ps ax 
# ps axu 
Print A Process Tree 
# ps -ejH 
# ps axjf 
# pstree 
Print Security Information 
# ps -eo euser,ruser,suser,fuser,f,comm,label 
# ps axZ 
# ps -eM 

See Every Process Running As User ubuntu 
# ps -U ubuntu -u ubuntu u 


Set Output In a User-Defined Format 
# ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm 
# ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm 
# ps -eopid,tt,user,fname,tmout,f,wchan 
Display Only The Process IDs of Lighttpd 
# ps -C lighttpd -o pid= 
OR 
# pgrep lighttpd 
OR 
# pgrep -u ubuntu php-cgi 
for example i use mine machine PID(process ID) 55977
Display The Name of PID 55977 
# ps -p 55977 -o comm= 
Find Out The Top 10 Memory Consuming Process 
# ps -auxf | sort -nr -k 4 | head -10 




here the different in the command in the cpu use and the meaomory is 
about the -k value.. 

in the sort command their is the -k option what its mean..?? 

-k, --key=KEYDEF          sort via a key; KEYDEF gives location and type 

Find Out top 10 CPU Consuming Process 
# ps -auxf | sort -nr -k 3 | head -10 



#6: free - Memory Usage 
The command free displays the total amount of free and used physical and swap 
memory in the system, as well as the buffers used by the kernel. 
# free 





#7: iostat - Average CPU Load, Disk Activity 
The command iostat report Central Processing Unit (CPU) statistics and input/output 
statistics for devices, partitions and network filesystems (NFS). 
# iostat 






#8: sar - Collect and Report System Activity 
The sar command is used to collect, report, and save system activity information. To 
see network counter, enter: 
# sar -n DEV | more 
 but before used this command you have to make sure that your /etc/default/sysstat is enabled.

#sudo leafpad /etc/default/sysstat
this will pop u the sysstat file ,where you have enable it by putting 'true' word in lace of 'false'..




NOTE: actually i used here so many commands attributes in all these commands..so if you want to know more basics commands plaese refer to mine website www.zerocool-hexor.blogspot.in 
where you will get the some basic articles and videos based on linux commanding

To display the network counters from the 24th: 
# sar -n DEV -f /var/log/sa/sa24 | more 
You can also display real time usage using sar: 
# sar 4 5 



#9: mpstat - Multiprocessor Usage 
The mpstat command displays activities for each available processor, processor 0 being 
the first one. mpstat -P ALL to display average CPU utilization per processor: 
# mpstat -P ALL 




#10: pmap - Process Memory Usage 
The command pmap report memory map of a process. Use this command to find out 
causes of memory bottlenecks. 
# pmap -d PID 
To display process memory information for pid # 3663, enter: 
# pmap -d 3663


The last line is very important: 
mapped: 27528K    writeable/private: 2828K    shared: 28K 

mapped: 27528K  total amount of memory mapped to files 
writeable/private: 2828K the amount of private address space 
shared: 28K the amount of address space this process is sharing with others 

#11 and #12: netstat and ss - Network Statistics 
The command netstat displays network connections, routing tables, interface statistics, 
masquerade connections, and multicast memberships. ss command is used to dump 
socket(IPs & Ports) statistics. It allows showing information similar to netstat. See the following 
resources about ss and netstat commands: 







#13: iptraf - Real-time Network Statistics 
The iptraf command is interactive colorful IP LAN monitor. It is an ncurses-based IP LAN 
monitor that generates various network statistics including TCP info, UDP counts, ICMP 
and OSPF information, Ethernet load info, node stats, IP checksum errors, and others. It 
can provide the following info in easy to read format: 

# sudo iptraf



Network traffic statistics by TCP connection 
           IP traffic statistics by network interface 
           Network traffic statistics by protocol 
           Network traffic statistics by TCP/UDP port and by packet             size 
           Network traffic statistics by Layer2 address 

#14: /Proc file system - Various Kernel Statistics
/proc file system provides detailed information about various hardware devices and
other Linux kernel information. Common /proc examples:
# cat /proc/cpuinfo | more





# cat /proc/meminfo | more
# cat /proc/zoneinfo | more
# cat /proc/mounts    | more

** try rest off commands by own.
#15: Gnome System Monitor - Real-time Systems
Reporting and Graphing
The System Monitor application enables you to display basic system information and
monitor system processes, usage of system resources, and file systems. You can also
use System Monitor to modify the behavior of your system. Although not as powerful as
the KDE System Guard, it provides the basic information which may be useful for new
users:
*Displays various basic information about the computer's hardware and software.
*Linux Kernel version
*GNOME version
*Hardware
*Installed memory
*Processors and speeds
*System Status
*Currently available disk space
*Processes
*Memory and swap space
*Network usage
*File Systems
*Lists all mounted filesystems along with basic information about each.





Bonus: Additional Tools
A few more tools:
$nmap - scan your server for open ports.

$lsof - list open files, network connections and much more.

$ntop web based tool - ntop is the best tool to see network usage in a way similar to
what top command does for processes i.e. it is network traffic monitoring software.
You can see network status, protocol wise distribution of traffic for UDP, TCP, DNS,
HTTP and other protocols.

$Conky - Another good monitoring tool for the X Window System. It is highly
configurable and is able to monitor many system variables including the status of
the CPU, memory, swap space, disk storage, temperatures, processes, network
interfaces, battery power, system messages, e-mail inboxes etc.

$GKrellM - It can be used to monitor the status of CPUs, main memory, hard disks,
network interfaces, local and remote mailboxes, and many other things.

$vnstat - vnStat is a console-based network traffic monitor. It keeps a log of hourly,
daily and monthly network traffic for the selected interface(s).

$htop - htop is an enhanced version of top, the interactive process viewer, which
can display the list of processes in a tree form.

$mtr - mtr combines the functionality of the traceroute and ping programs in a
single network diagnostic tool.

#socklist: to see the open port running in the debian system




 their are many other commands but i can't cover all of these in this articles.
I hope you like it.
--------------------------------------------------------------------
Follow Me on:

 Twitter:
                                                                   


Facebook:

Popular Posts