Commands Line Utilities: Difference between revisions

From mylearnings
Jump to navigationJump to search
No edit summary
No edit summary
Line 24: Line 24:
* Find Parent (PPID) of a process with PID.
* Find Parent (PPID) of a process with PID.
<pre>
<pre>
</pre>


= File System =
= File System =
Line 37: Line 38:


ps -o ppid= -o comm= -p <PID>
ps -o ppid= -o comm= -p <PID>
= Networking =
= Host Command =
<pre>
pristal@personal-system:~$ host google.com
google.com has address 142.250.196.14
google.com has IPv6 address 2404:6800:4007:829::200e
google.com mail is handled by 10 smtp.google.com.
pristal@personal-system:~$
</pre>
* To get the nameservers associated with a domain,
<pre>
pristal@personal-system:~$ host -t ns google.com
google.com name server ns2.google.com.
google.com name server ns1.google.com.
google.com name server ns3.google.com.
google.com name server ns4.google.com.
pristal@personal-system:~$
</pre>
* To get the mailserver associated with a domain,
<pre>
pristal@personal-system:~$ host -t mx google.com
google.com mail is handled by 10 smtp.google.com.
pristal@personal-system:~$
</pre>
::- Mail server is ''smtp.google.com''
::- Here the priority is set to ''10''
= Nslookup command =
= NetCat Command =
* nc
= Dig Command =
* dig
= Nmap Command =
= Curl Command =
= Wget Command =

Revision as of 13:14, 16 June 2025

Process

  • Find PID of a known program.
pidof <application name>
  • Find all the direct and indirect child processes of a process.
pstree -p <PID>
  • List all the files opened by a process with PID.
lsof -p <PID>
  • Find details of a file descriptor corresponding to a PID.
lsof -p <PID> -a -d <FD>
- -a => Stands for 'AND' Operation.
- -d => File descriptor for which we need to find details.
  • Find Parent (PPID) of a process with PID.

File System

  • Check filesystem type.
df -T <Path>
  • See details about a mount.
findmnt -T <Path>

ps -o ppid= -o comm= -p <PID>

Networking

Host Command

pristal@personal-system:~$ host google.com
google.com has address 142.250.196.14
google.com has IPv6 address 2404:6800:4007:829::200e
google.com mail is handled by 10 smtp.google.com.
pristal@personal-system:~$ 
  • To get the nameservers associated with a domain,
pristal@personal-system:~$ host -t ns google.com
google.com name server ns2.google.com.
google.com name server ns1.google.com.
google.com name server ns3.google.com.
google.com name server ns4.google.com.
pristal@personal-system:~$ 
  • To get the mailserver associated with a domain,
pristal@personal-system:~$ host -t mx google.com
google.com mail is handled by 10 smtp.google.com.
pristal@personal-system:~$ 
- Mail server is smtp.google.com
- Here the priority is set to 10

Nslookup command

NetCat Command

  • nc

Dig Command

  • dig

Nmap Command

Curl Command

Wget Command