comm – compare two sorted files line by line.

Usage: comm [OPTION]… FILE1 FILE2
Compare sorted files FILE1 and FILE2 line by line.

With no options, produce three-column output. Column one contains
lines unique to FILE1, column two contains lines unique to FILE2,
and column three contains lines common to both files.

-1 suppress column 1 (lines unique to FILE1)
-2 suppress column 2 (lines unique to FILE2)
-3 suppress column 3 (lines that appear in both files)

–check-order check that the input is correctly sorted, even
if all input lines are pairable
–nocheck-order do not check that the input is correctly sorted
–output-delimiter=STR separate columns with STR
–help display this help and exit
–version output version information and exit

Note, comparisons honor the rules specified by ‘LC_COLLATE’.

Examples:
comm -12 file1 file2 Print only lines present in both file1 and file2.
comm -3 file1 file2 Print lines in file1 not in file2, and vice versa.

GNU coreutils online help:
Full documentation at:
or available locally via: info ‘(coreutils) comm invocation’

Change the user password or unlock the user account in sqlplus.

1. Connect as sysdba from the command line:

sqlplus / as sysdba

2. List all users:

select username from dba_users;

3. Check whether the user account is locked:

select * from dba_users where username = 'USERNAME';

4. If locked, use this command to unlock the account:

alter USER USERNAME account unlock;

5. To change the user’s password type the following command:

password USERNAME;

SSL – Check whether a private key matches a certificate or whether a certificate matches a certificate signing request (CSR).

Check whether a private key matches a certificate or whether a certificate matches a certificate signing request (CSR). If you are receiving an error that the private doesn’t match the certificate or that a certificate that you installed to a site is not trusted, try one of these commands. Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key.

root# openssl x509 -noout -modulus -in certificate.crt | openssl md5
root# openssl rsa -noout -modulus -in privatekey.key | openssl md5
root# openssl req -noout -modulus -in csr.csr | openssl md5

For example:
root# openssl req -noout -modulus -in just4testcert_req.csr | openssl md5
(stdin)= 61c59f9a9ddddc032e56fe2e46a91409
root# openssl rsa -noout -modulus -in just4test_server.key | openssl md5
(stdin)= 61c59f9a9ddddc032e56fe2e46a91409

Clear Winbind cache

Clear all Winbind caches and flush Net cache, always take a backup before deleting 😉

Stop the Winbind service and Samba service (if you have it):

root# service winbind stop
root# service smb stop

Clear the Samba Net cache:

root# net cache flush

Delete the Winbind caches:

root# rm –f /var/lib/samba/*.tdb
root# rm –f /var/lib/samba/group_mapping.ldb

Start the Samba (if you have it) and then Winbind services

root# service smb start
root# service winbind start

SSH – PermitRootLogin

PermitRootLogin
Specifies whether root can log in using ssh(1). The argument must be “yes”, “without-password”, “forced-commands-only”, or “no”.
The default is “yes”.
If this option is set to “without-password”, password authentication is disabled for root.
If this option is set to “forced-commands-only”, root login with public key authentication will be allowed, but only if the command option has been specified. Useful for backups 😉 All other authentication methods are disabled for root.
If this option is set to “no”, root is not allowed to log in.
Thus without-password allows root login only with public key authentication.

lsof – list open files.

lsof – list open files for more information, please see the man page 😉

List process running on a port
root# lsof -i :port_number

Lists IPv4, use 6 for IPv6
root# lsof -i 4

Lists open files for TCP port ranges 1-1024
root# lsof -i :1-1024

Lists by pid
root# lsof -p PID

List files opened by a specific user
root# lsof -u username

Kill all activity for a particular user
root# killall -9 `lsof -t -u username`

List all network connections
root# lsof -i

List the opened files in a directory
root# lsof +D path_of_the_directory

List the opened files based on process names
root# lsof -c process_name

File attributes – chattr and lsattr.

File attributes

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
c: compressed
d: no dump
e: extent format
i: immutable
j: data journalling
s: secure deletion
t: no tail-merging
u: undeletable
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
----ia---------- /path/to/file
root#

CUPS – /var/spool/cups file beginning with "d" and "c"

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/
--cut
-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
root#

Proxy_interface – Postfix

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.

Example:

proxy_interfaces = 1.2.3.4

If you miss this step, you’ll see messages like this in your log file:

Apr 8 20:10:14 hades postfix/smtp[1908]: 08CABB59: to=, relay=mail.4network.eu[46.7.161.66]: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)

http://www.postfix.org/postconf.5.html#proxy_interfaces