lsof – list open files for more information, please see the man page 😉
List process running on a port
root# <code>lsof -i :port_number</code>
Lists IPv4, use 6 for IPv6
root# <code>lsof -i 4</code>
Lists open files for TCP port ranges 1-1024
root# <code>lsof -i :1-1024</code>
Lists by pid
root# <code>lsof -p PID</code>
List files opened by a specific user
root# <code>lsof -u username</code>
Kill all activity for a particular user
root# <code>killall -9 `lsof -t -u username`</code>
List all network connections
root# <code>lsof -i </code>
List the opened files in a directory
root# <code>lsof +D path_of_the_directory</code>
List the opened files based on process names
root# <code>lsof -c process_name</code>
<strong>chattr</strong> – (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.
<strong>lsattr</strong> – 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.
<code>root# chattr +i /path/to/file</code>
A file is set with “a” attribute, can only be open in append mode for writing.
<code>root# chatt +a /path/to/file</code>
To remove an attribute on a file just change + to -.
To list the file atributes, use the lsattr command:
<code>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 = 184.108.40.206
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[220.127.116.11]: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)