Posts Tagged ‘linux’

Setting the Hardware Clock

Setting the hardware clock

To set the hardware clock, my favourite way is to set the system clock first, and then set the hardware clock to the current system clock by typing “/sbin/hwclock –systohc” (or “/sbin/hwclock –systohc –utc” if you are keeping the hardware clock in UTC). To see what the hardware clock is currently set to, run hwclock with no arguments. If the hardware clock is in UTC and you want to see the local equivalent, type “/sbin/hwclock –utc”

Setting the System Clock

Setting the system clock

To set the system clock under Linux, use the date command. As an example, to set the current time and date to July 31, 11:16pm, type “date 07312316” (note that the time is given in 24 hour notation). If you wanted to change the year as well, you could type “date 073123161998”. To set the seconds as well, type “date 07312316.30” or “date 073123161998.30”. To see what Linux thinks the current local time is, run date with no arguments.

Protect yourself from being a spam base

Protecting yourself from being a spam base

Sendmail allows for someone to telnet to port 25 and do an expn (expand) to see what users and aliases are on your machine. Also, vrfy (verify) means someone can get legal e-mail addresses from your box and send spam through your machine.

Don’t want that, so look in your /etc/sendmail.cf file for a line that looks like this:

###############
# Options #
###############

Now cut and paste these next few lines below that:

# turning off the expand option and requiring a helo from
# a remote computer
Opnoexpn,novrfy,needmailhelo

Now there is no expansion, no verify, and sendmail requires a helo with a legitimate DNS in order to use the mailer.

Then look in your /etc/mail/aliases file and ensure you have only your own boxen and/or subnet in there as OK or RELAY. That will help cut down on spammers’ ability to find relay machines to do their dirty work for them.

A script for cleaning up after programs that create autosave and backup files.

A script for cleaning up after programs that create autosave and backup files.
Here is a simple two-liner which recursively descends a directory hierarchy removing emacs auto-save (#) and backup (~) files, .o files, and TeX .log files. It also compresses .tex files and README files. I call it ‘squeeze’ on my system.

#!/bin/sh
#SQUEEZE removes unnecessary files and compresses .tex and README files
#By Barry tolnas, [email protected]
#
echo squeezing $PWD
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec
rm -f {} \;
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;

How do I find which library in /usr/lib holds a certain function?

How do I find which library in /usr/lib holds a certain function?

What if you’re compiling and you’ve missed a library that needed linking in? All gcc reports are function names… Here’s a simple command that’ll find what you’re looking for:

for i in *; do echo $i:;nm $i|grep tgetnum 2>/dev/null;done

Where tgetnum is the name of the function you’re looking for.

1 3 4 5

Content Protected Using Blog Protector By: PcDrome. & GeekyCube.