Tuesday, September 21, 2010

Linux Commands repository

  • Display the redhat release: 

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)



  • Display installed packages
yum list installed|less

  • Display the most recent installed packages.

rpm -qa --last

  • sshfs = Winscp for linux.
    • sshfs username@hostname:/ /tmp/mnt will mount hostname under the directory /tmp/mnt.
    • Then use native file manager app (Dolphin on Centos 7) to move files around.
  • Operating system:
    • lsb_release -a

Verifying Which Ports Are Listening

nmap -sT -O localhost


Mode details here:
Nmap is a great port scanner, but sometimes you want something more authoritative. You can ask the kernel what processes have which ports open by using the netstat utility:
me@myhost:~$ sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address   Foreign Address   State    PID/Program name
tcp        0      0 127.0.0.1:53    0.0.0.0:*         LISTEN   1004/dnsmasq    
tcp        0      0 0.0.0.0:22      0.0.0.0:*         LISTEN   380/sshd        
tcp        0      0 127.0.0.1:631   0.0.0.0:*         LISTEN   822/cupsd       
tcp6       0      0 :::22           :::*              LISTEN   380/sshd        
tcp6       0      0 ::1:631         :::*              LISTEN   822/cupsd       
The options I have given are:
  • -t TCP only
  • -l Listening ports only
  • -n Don't look up service and host names, just display numbers
  • -p Show process information (requires root privilege)

In this case, we can see that sshd is listening on any interface (0.0.0.0) port 22, and cupsd is listening on loopback (127.0.0.1) port 631. Your output may show that telnetd has a local address of 192.168.1.1:23, meaning it will not answer to connections on the loopback adapter (e.g. you can't telnet 127.0.0.1).

No comments:

Post a Comment