|Home - Services - Software - Hosted Sites - Contact|
With over 20 years of Unix experience, there are a number of questions/topics that come up over and over again in technical forums. This list is an attempt to summarise them and provide a useful resource for people with the same questions.
The find command
The find command is incredibly useful and probably accounts for more questions that any other Unix utility. There are a few areas of confusion that regually come up.
Quite often there is a question related to finding files based on their creation time. Unix/Linux filesystems do not store the creation time of a file. There are three categories you can use:
Related to above, are the time specifications for the -atime, -ctime and -mtime options. All too often, you will see an example like:
find /dir -type -f -mtime +1
where the it is stated that this command will find files older than 1 day. This is not quite correct. It actually means older than 48 hours from the current time (in effect, files older than 2 days).
To find files older than one day, you would use:
find /dir -type f -mtime +0
The prefix to the number makes all the difference. The following should hopefully make it clear:
Quite often, people will try to read lines from a file with a 'for' loop and wonder why they get one word at a time. A 'for' loop interates over whitespace (by default) separated items. The separator is determined by the specicial IFS (Internal Field Separator) environment variable. To read a line at a time from a file, you should use a while loop, eg:
while read line do echo "$line" done
Ginini Technologies Ltd