≡ Menu

sockets

Linux Find Out CPU Architecture Information

How do I find out my CPU architecture information under Linux operating systems?
[click to continue…]

Sysadmin because even developers need heroes!!!

Linux: Find Out Which Process Is Listening Upon a Port

How do I find out running processes were associated with each open port? How do I find out what process has open tcp port 111 or udp port 7000 under Linux?
[click to continue…]

Linux Syslogd: Nothing Gets Logged Using /dev/log And /jail/apache/dev/log

I‘ve configured my Apache in chrooted jail at /jail/apache directory. However, my syslogd is not working and nothing gets logged using /dev/log and /jail/apache/dev/log. How do I fix this problem under CentOS 5.x AMD64 with SELinux?
[click to continue…]

BIND: Max open files (1024) is smaller than max sockets (4096) Error and Solution

While going though my logs I found that BIND9 on Debian version 5.x is giving a warning which read as follows:

max open files (1024) is smaller than max sockets (4096)

How do I fix this problem?
[click to continue…]

Linux / UNIX Find Out What Program / Service is Listening on a Specific TCP Port

Q. How do I find out which service is listening on a specific port? How do I find out what program is listening on a specific TCP Port?
[click to continue…]

How To Upgrade FreeBSD To New Release

Q. I’ve custom compile kernel and I’d like to upgrade my system to latest stable release. How do I upgrade FreeBSD to new release without using freebsd-update binary tool?
[click to continue…]

Examining the Linux / FreeBSD / UNIX filesystem with ls command

Q. I’m new to Linux and how do I examine filesystem and identify regular files or directories?

A. Both Linux and UNIX comes with ls command for examining the filesystem. You can use ls command to look at the filesystem. ls command can display:
=> Character devices
=> Regular files
=> Sym links (symbolic links)
=> Directories
=> Pipes
=> Sockets
=> Block devices

ls command examples

Display /etc directory files, enter:
$ ls /etc
When invoked without any arguments, ls lists the files in the current working directory:
$ ls
Use -l (long option) to lists filenames, sizes, permissions, type and all other information:
$ ls /etc/passwd
Output:

-rw-r--r-- 1 root root 2453 Jul 17 16:25 /etc/passwd

See Linux / UNIX file permissions for more information

Directory

A directory is marked with a d as the first letter of the permissions field:
ls -ld /etc
Output:

drwxr-xr-x 88 root root 12288 Aug  5 23:46 /etc

Symbolic link

A symbolic link is marked with an l (lower case L) as the first letter of the permissions string:
ls -l /bin/nisdomainname
Output:

lrwxrwxrwx 1 root root 8 Jul 10 08:50 /bin/nisdomainname -> hostname

Similarly,

  • A named pipe is marked with a p as the first letter of the permissions string.
  • A socket is marked with a s as the first letter of the permissions string.
  • A character device is marked with a c as the first letter of the permissions strings. (ls -l /dev/console)
  • A block device is marked with a b (ls -l /dev/sdb1).

How do I find out what network services are running or listing under Linux?

Q. How do I find out what network service are running under Linux operating system?

A. For security reason it is necessary to find out what services are running. With the help of netstat command, you can print information about the Linux networking subsystem including running services. It can display program name and PID for each socket belongs to. Use netstat as follows:

$ netstat -atup

OR

$ netstat -atup | grep LISTEN

Where,

  • -t : Select all TCP services
  • -u : Select all UDP services
  • -a : Display all listening and non-listening sockets.
  • -p : Display the PID and name of the program to which each socket belongs