June 27, 2017

Do you need to find large files?

Use the following command to get a list of files sorted from large to small on your unix machine. du -ak |sort -rn |less If you want the output to be more “human” readable use: du -ah |sort -rh|less This is useful if you want to cleanup your files, or when a disk is filling up.

January 1, 2017

Firewalls -block rather than scan

If you run a so called “New Generation Firewall” it will probably have an IDS/IPS system that scans all traffic. This eats a lot of CPU and slows down your firewall. There are lots of reliable lists (blocklists) of IP addresses out there that you can use to drop traffic from the bad guys before scanning, saving lots of CPU and increasing your throughput. Research the lists you plan to use, here is a good place to start your research: FireHOL IP Lists. Read more

December 12, 2016

CPU info in FreeBSD

There are various methods to get CPU information on FreeBSD sysctl -a | grep -i cpu | less sysctl -a | egrep -i 'hw.machine|hw.ncpu|hw.model' “sysctl” retrieves the kernel state. You can also use dmesg to get the information: dmesg | grep -i cpu grep -i cpu /var/run/dmesg.boot

November 3, 2016

Change your Unix login shell

If you don’t like the default shell on your system you can easily change it with the chsh command e.g. chsh -s /opt/local/bin/bash You will be asked to enter your password to make the change.

May 30, 2016

Unix - finding programs

You can use whereis to search standard binary, manual page and source directories for the specified programs. This can be particularly handy when you are trying to find where in the ports tree an application is. Try whereis firefox and whereis whereis.

May 30, 2016

Unix - Aliases

You can use aliases to decrease the amount of typing you need to do to get commands you commonly use. Examples of fairly popular aliases include (in Bourne shell style, as in /bin/sh, bash, ksh, and zsh): alias lf="ls -FA" alias ll="ls -lA" alias su="su -m" In csh or tcsh, these would be alias lf ls -FA alias ll ls -lA alias su su -m To remove an alias, you can usually use unalias aliasname. Read more

May 30, 2016

Unix - less or more

Need to do a search in a man page or in a file you’ve sent to a pager (like less or more)? Use “/search_word”. To repeat the same search, type “n” for next.

May 30, 2016

FreeBSD - man pages

FreeBSD and other Unix systems use man pages for system documentation, they are called by the man command. For FreeBSD the following are useful man pages: man firewall will give advice for building a FreeBSD firewall man hier will explain the way FreeBSD filesystems are normally laid out. Man pages are divided into section depending on topic. There are 9 different sections numbered from 1 (General Commands) to 9 (Kernel Developer’s Manual). Read more

May 8, 2016

Bash Prompt

You can adjust your bash prompt to virtually anything you like. Handy bash(1) prompt: PS1="\u@\h \w \!$" You can find more here: Bash Prompts

© Arnold Greyling 2023