Top 15 most frequently used Linux Commands

Views: 139   

1.) To check if port is open and a process is running in it use below command :-

[email protected]:~# netstat -tulpn | grep 9092

2.) To check if a process is running :-

 [email protected]:~# ps -ef | grep zookeeper

3.) To kill a process :-

[email protected]:~#  kill -9 9092

4.) To switch to root user :-

[email protected]:~# sudo -i

5.) To empty log file :-

[email protected]:~# truncate logfile - - size 0

6.) To grep in log file :-

[email protected]:~# grep 'hello' yourfile.log
[email protected]:~# grep -rnw 'sparkAll.log' -e 'ApplicationMaster'

7.) PING (Packet INternet Groper) command is to test connectivity between two machines.

[email protected]:~# ping destinationHostName/destinationIPAddress

8.) To use Find cmd :-

[email protected]:~# find / -name xxxx
[email protected]:~# locate / -name xxxx

9.) To view top process running : top

[email protected]:~# top

To quit, type q

10.) To find list of all processes running :-

[email protected]:~#  initctl list

11.) To find top files greater than 10M size :-

[email protected]:~# sudo find / -type f -size +10M -exec ls -lh {} \;

12.) To search for a software in apt repository

[email protected]:~#  apt-cache search mysql-server

13.) to search for a string in file opened with vi, use '/' and type required string, to go to next occurance type n or N

14.) The telnet is used to connect to remote hosts using a command line interface

[email protected]:~# telnet destinationHostName portNo

15.) To find ipaddress of the linux machine

[email protected]:~# ifconfig | grep inet
On By