May 27, 2021

Examples of using find in Unix like systems

find is one of the Unix utilities that is most often used. As the name says it is used to find something i.e. files. It has many options you can use to specify which files to look for. One of the simplest uses is find . -name somefile that will look for the file named somefile in the current directory. If you use find . -iname somefile a case insensitive search will be done for somefile. Read more

August 25, 2018

Collection of FreeBSD tips

This is a collection of FreeBSD tips that comes with the fortune programe included in the system. Many of these will work on any Unix system. Any user that is a member of the wheel group can use “su -” to simulate a root login. You can add a user to the wheel group by editing /etc/group. By pressing “Scroll Lock” you can use the arrow keys to scroll backwardthrough the console output. Read more

July 12, 2018

Outlook is rubbish!

Microsoft Outlook especially older versions is junk, but you probably knew that already. For some reason Outlook often sends out a message with incorrect syntax e.g. “[email protected]”. Mail servers like postfix will reject these messages but Outlook will not warn its user that there is a problem. Instead it will keep the message in the outbox and continously retry sending. If you are a postfix admin you can strip the apostrophes with a command filter. Read more

October 23, 2017

Change vim 8.0 .vimrc behaviour back to sanity

When a user doesn’t have a /.vimrc file in vim 8.0 (and possibly later) vim loads the default configuration file after the systemwide vimrc file created by the system administrator. This overides any settings the system administrator made. This is of course totally unexpected and frustrating especially when you upgrade from earlier versions. Some may even call it insane and it is definitely not expected behaviour. Anyway below is a way to prevent that from happening. Read more

August 26, 2017

UNIX - Use sed to edit files

sed is one of the commands that have been around forever on Unix systems. sed is a stream editor that you can use to perform basic text transformations on an input stream (a file or input from a pipeline). Want to use sed to edit a file in place? Well, to replace every ’e’ with an ‘o’, in a file named ‘foo’, you can do: sed -i.bak s/e/o/g foo And you’ll get a backup of the original in a file named ‘foo. Read more

August 26, 2017

UNIX - Specify file and disk size output

If you want df, ls or du and other commands to display disk sizes in kilobytes instead of 512 byte blocks, set BLOCKSIZE in your environment to ‘K’. You can also use ‘M’ for Megabytes or ‘G’ for Gigabytes. If you want them to automatically select the best size then use df -h for example.

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.

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.

© Arnold Greyling 2023