Linux

Jump to: navigation, search
Categories » Linux » Linux

Contents

Software

apf (Firewall)

From LW support:

If you ssh into your server, you can check the file /etc/apf/deny_hosts.rules which lists the IPs that have been blocked. The IP can be added to the /etc/apf/allow_hosts.rules as a precaution.

To list blocked IPs: apf -l

To unblock an IP: apf -u HOST

More Commands

Opening Ports

Edit /etc/apf/conf.apf and look for

# Common ingress (inbound) TCP ports
IG_TCP_CPORTS="..."

Modify this list as necessary, then restart apf:

service apf restart

Exim

Log files:

Test Session

To create a fake session to see how Exim will respond to a particular IP address, use: exim -bh <ip address> [1] [2]

Commands

grep

To reverse the filtering of grep (i.e., allow everything except the specified pattern) pass the -v option.

less

To disable line wrapping, use -S.

More info: Wikipedia:less (Unix)

tail

Filtered monitoring of a logfile:

tail -f exim_mainlog | grep SearchParameters

patch

Sample usage of patch to apply a MediaWiki update from the ~/public_html/wiki/ directory:

patch -p1 -d w <mediawiki-i18n-1.13.1.patch

-p1: Remove the first directory from each file path in the patch file.
-d w: Set the working directory to w (since the actual MediaWiki files are in ~/public_html/wiki/w/).
<mediawiki-i18n-1.13.1.patch: This passes the patch file via stdin.

ifconfig

Network information and configuration.

which

Locate a program file in the user's path. Example:

$ which svn
/usr/bin/svn

du

Show disk usage of each directory below the current directory:[3]

du -bsh *

tar

Adding files to a tar archive and deleting them:

tar cvf destination.tar photo*.jpg --remove-files

Number of accounts

cat /etc/passwd | grep /home | wc -l

[4]

In a PHP script

<?php
exec('cat /etc/passwd | grep /home | wc -l', $r);
print 'Number of user accounts: '.$r[0];
?>

More Information

References

Retrieved from "http://wiki.ike.to/Linux"
Personal tools
Namespaces
Variants
Actions
Navigation
Categories
Toolbox