Sunday 26 February 2017

Linux Commands

Linux Regularly using commands


                 function                                            linux                   
                system info                                                           uname -a                                              

                memory                                                                 grep MemTotal /proc/meminfo, hwconfig
                                                                                               
                memory by cpu                                                   mpstat –P ALL

                memory i-o                                                           vmstat                                            
                memory usage                                                     watch free –m, top
                                                                                              
                system activity info                                            sar –u               
                device stats                                                           iostat                                    

                hardware config                                                   dmesg

                interface activity                                                 ifstat

                network stats                                                        netstat

                cpu info                                                                 cat /proc/cpuinfo                                

                processor status                                                      psrinfo –v

            memory conf                               memconf                                                                                                                      

                swap space                                                           ? swapon -s          

                monitor executing processes                             top                                                         

                machine status                                                     uptime                                              

                find what is mounted                                          mount                                                   

                find what groups you belong to                        groups                                                 

                ps                                                                            ps -ef                                                                                  


                installed software                                                 rpm –a –i (-qa)                                        

                network routing tables                                        netstat –rn      

                network interface config                                    ifconfig

                network packet route                                          traceroute server_name

                operating systime info                                        /etc/redhat-release


                log files

                                log file                                                    /var/log/messages

                                Mail log                                                 /var/log/maillog

                                Installed packages                              /var/log/rpmkgs                                  

                                Mount options                                     /etc/fstab

                                Mount options                                     /proc/mounts

                                Hardware                                              /var/log/dmesg

                                Kernel parameters                               /etc/sysctl.conf


                disk & file monitoring

                                du -k| sort -n | tail                                                top 10 directories in space usage

                df /dirname or filename                                     to get the space on a certain directory (if dirname is  omitted, all directories)

                                ls –al | sort –nbk5                                                                sort a directory by file size

                                find . -xdev -type f -size +10000000c –ls       to find files bigger then 10000000 characters

                                ls -l | grep \^- | sort -n -k 5                                   find smallest to largest file in a directory (sort –nr –k 5   to reverse size)

No comments:

Post a Comment