lsof – list open files for more information, please see the man page 😉
List process running on a port
lsof -i :port_number
Lists IPv4, use 6 for IPv6
lsof -i 4
Lists open files for TCP port ranges 1-1024
lsof -i :1-1024
Lists by pid
lsof -p PID
List files opened by a specific user
lsof -u username
Kill all activity for a particular user
killall -9 `lsof -t -u username`
List all network connections
List the opened files in a directory
lsof +D path_of_the_directory
List the opened files based on process names
lsof -c process_name
chattr – (Change Attribute) is a command line Linux utility that is used to set/unset certain attributes to a file in Linux system to secure accidental deletion or modification of important files and folders, even though you are logged in as a root user.
lsattr – list file attributes on a Linux second extended file system
By default, file attributes are not preserved by cp, rsync, and other similar programs.
For ext2 and ext3 file systems, the e2fsprogs package contains the programs lsattr and chattr that list and change a file’s attributes, respectively. Though some are not honored by all file systems, the available attributes are:
a: append only
d: no dump
e: extent format
j: data journalling
s: secure deletion
t: no tail-merging
A: no atime updates
C: no copy on write
D: synchronous directory updates
S: synchronous updates
T: top of directory hierarchy
For example, a file is set with “i” attribute, cannot be modified (immutable). Means no renaming, no symbolic link creation, no execution, no writable, only superuser can unset the attribute.
root# chattr +i /path/to/file
A file is set with “a” attribute, can only be open in append mode for writing.
root# chatt +a /path/to/file
To remove an attribute on a file just change + to -.
To list the file atributes, use the lsattr command:
root# lsattr /path/to/file
File beginning with “d”
The files whose names begin with a “d” are temporary files for active print jobs. These files contain the actual data of the file to be printed in whatever format as PostScript, text, PDF, etc. By default, these files should be removed approximately 30 seconds after a print job is completed, canceled, or aborted.
Files beginning with “c”
The files whose names begin with a “c” are “job history” files. They are retained until explicitly removed by an administrator with the CUPS cancel command.
The numeric portion in the names of both types of files is the print job number associated with the file. So, for example, the file /var/spool/cups/d19170 is the print data file associated with print job 19170, and the file /var/spool/cups/c19170 is the job history file for that same print job.
root# ls -lah /var/spool/cups/
-rw------- 1 root lp 821 Apr 13 08:52 c19169
-rw------- 1 root lp 819 Apr 13 08:53 c19170
-rw------- 1 root lp 819 Apr 13 08:54 c19171
-rw-r----- 1 root lp 276M Apr 13 08:07 d19170-001
drwxrwx--T 2 root lp 4096 Jan 16 10:16 tmp
proxy_interfaces (default: empty)
The network interface addresses that this mail system receives mail on by way of a proxy or network address translation unit. This feature is available in Postfix 2.0 and later.
You must specify your “outside” proxy/NAT addresses when your system is a backup MX host for other domains, otherwise mail delivery loops will happen when the primary MX host is down.
proxy_interfaces = 22.214.171.124
If you miss this step, you’ll see messages like this in your log file:
Apr 8 20:10:14 hades postfix/smtp: 08CABB59: to=, relay=mail.4network.eu[126.96.36.199]:25, delay=1.4, delays=0.39/0.01/0.99/0, dsn=4.4.6, status=deferred (mail for 4network.org loops back to myself)