DEV Community

Joydeep Mukherjee
Joydeep Mukherjee

Posted on

Few basic commands that may come in handy for System Engineers

Process related

ps -ef|egrep "java||httpd||nginx"

Or

ps -ef|grep java

(Any process that you want to grep)


 ( To check process utilization)


```kill -9 pid```

 ( to kill a process)


```kill -3 pid```

 (to take heapdump)


```kill -9 $(lsof -t -i:port_number)```




```systemctl status/stop/start service_name```




```service service_name stop/start/status```




# Logs related



```tail -100f access.log/error.log```




```tail -100f SystemOut.log|grep -i "hung"```

 (to check out the hung threads)


```more access.log/error.log```

 ( to check the previous logs)

# FileSystem cleaning



```df -kh /directory_name```




```du -sh *|sort -n```




```find file_path -type f -size +100M -mtime +90 -exec rm -r{} \;```



# SSL related

To import a java certificate:-


```./keytool -import -keystore key_store_path -trustcacerts -file cert_file.cer -storepass changeit```



To create a new java keystore:-


```./keytool -genkey -alias alias_name -keyalg rsa -keysize 2048 -keystore name_keystore -storepass changeit

To raise a Cert request or raise a csr:-
./keytool -certreq -file cert_file_name.csr -keystore name_keystore -storepass changeit```



To view a certificate file using openssl:-


```openssl x509 -text -in file_name.cer```

 /


```openssl x509 -text -inform DER file_name.cer```



To create a new self signed certificate using openssl:-


```openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout file_path_key_name.key -out file_path_cert_name.crt```



# Network Rekated



```netstat -at/au```

 (to show ports open for tcp or udp)


```curl -Ik URL```

 (to check header information and return code)


```nslookup ip_address/domain```


















Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Just a heads up that you can add highlighting to the code blocks if you'd like. Just change:

code block with no colors example

... to specify the language:

code block with colors example

More details in our editor guide!

Collapse
 
joydeep999 profile image
Joydeep Mukherjee

Thanks for the heads up Sloan!!