Linux Commands

1: To check out the version and release of your operating system the command is
 ----->root# lsb_release -rd
2: To check your server load a number of commands are used:


1-a: ps
This command is used to check the process running on the server. " ps " command will list all the running process with there respective process ID.
1-b:Use the following option to get more process information from the " ps " commands,
root@server [~]$ ps -aux


1-c:pstree
This command is also used the check the process on the server. " pstree " command will list all the running process in the form of a tree structure.


1-d: pstree -p

1-e:top
This command is used to find the load on the server. " top " command can also be used to find the process and users that causes load on the server. It gives information about the total process, sleeping process, the zombie process etc.
root@server [~]$ top -cd3


1-f:w
This command is also find the load and users on the server. " w " command will provide a brief description about the load, time, number of users and the uptime of the server.


1-g:uptime
This command gives the basic information about the uptime and load of the server.


1-h:netstat
This command is used to find the number of connections to the server. " netstat " command will list all the connections using httpd, exim, ftp etc. You can grep the needed port and find the number of connections to a particular port. You can find the Local Address, Foreign Address, State, port etc of all the connections.root@server [~]$ netstat -plan


1-i:mysqladmin processlist
This command is used to find the connections to the mysql database. It gives information about Id, User, Host, db, Command, Time, State and Info of a mysql request to the server.
root@server [~]$ mysqladmin processlist


1-j:Blocking IP [ apf, csf ]
APF and CSF are firewall software’s.
You can use these commands to block a particular IP from connecting to the server. This command is mainly used when you find too many connections from a particular IP. Normally too many connection might be a attack to the server. So it is important to block such IP before it interrupts the balance of the server.
Check which firewall is installed on your server and use it accordingly.
Example:
root@server [~]$ apf -d <IP>
or
root@server [~]$ csf -d <IP>
1-k: telnetTELNET (TELecommunication NETwork) is a network protocol used on the Internet. TELNET is a client-server protocol, based on a reliable connection-oriented transport. This command will help us to find if a particular port on the server is open or not.root@server [~]$ telnet google.com 80

 How to find a word in multiple file in multiple directories:
# grep -i -H -R "word" /path/to/ parentdirectory/fromwhere/tosatart/searching
# grep -i -H -R "shahmeer" /var/ww/html
This will search out the name shahmeer is used in any file with path and all other information;
How to show your hardware devices in PC
#lshw | more
How to show network interfaces from commands prompt
#lshw -C network
How to scan wirless accessible networks from commands
#iwlist  wlan0 scan
where wlan0 is the name of wirless card of your system.
How to disable your network card
#ifdown eth0
How to enable you network card
#ifup eth0
How to check your wirless card driver is installed or not and all other information
# iwconfig wlan0 
CentOS
Log in to SSH and run the commands below to find out your version of CentOS:
#cat /etc/redhat-release
CentOS release 5.6 (Final)
To see what architecture your CentOS server is running: 
#arch
i686
To check what CentOS kernel is running:
#uname -a
Linux XXXX.ctkn.net 2.6.18-238.5.1.el5.028stabXX.Y #1 SMP DDD MMM timestamp TZ YYYY i686 i686 i386 GNU/Linux. 

 
Ubuntu
Log in to SSH and run the commands below to find out your version of Ubuntu: 
#cat /etc/issue
Ubuntu 10.04.2 LTS \n \l
To see what architecture and kernel your Ubuntu server is running:
#uname -a
Linux HOSTNAME 2.6.18-028stab0XX.Y #1 SMP DDD MMM dd time TZ YYYY x86_64 GNU/Linux
The x86_64 denotes a 64-bit OS.


 



No comments:

Post a Comment