Finding files with the Linux command line. Using find & locate.


Finding files with the Linux command line. Using find & locate.

The find command on Linux is very useful for finding commands on your Linux installation. In the example below, I am using wild-cards to look for all the c source files in a certain folder.

neo@deusexmachina:~/Documents$ find -name "*.c"
./strobe.c
./myftp.c
./utv_gd.c
./syscall.c
./program.c
./my.c
./pastie.c
./my2.c

Using the find command on the / root directory will be quite slower, but this is very useful when you are trying to track down a certain file on your Linux hard drive. As shown in the example below, you may specify a certain folder to search within.

neo@deusexmachina:/$ find /etc/ -name "ld.so.conf"
/etc/ld.so.conf
find: `/etc/ssl/private': Permission denied

The -maxdepth option will determine how many levels of sub-directories the find command will dig when looking for the files you seek.

neo@deusexmachina:/$ find / -maxdepth 3 -name "ld.so.conf"
/etc/ld.so.conf
find: `/tmp/aptitude-root.7141:nhAnV5': Permission denied
find: `/tmp/pulse-PKdhtXMmr18n': Permission denied
find: `/.pulse': Permission denied
find: `/root': Permission denied
find: `/lost+found': Permission denied
find: `/home/lost+found': Permission denied

The locate command uses a locatedb that is built regularly by a cron job, that contains the locations of files on the Linux file-system. This command therefore will be faster than the find command at locating various files. The updatedb command is run by the cron task and updates the database of all files making the file-system easily search-able. The Beagle search tool for KDE used this same method, it would build a database of all files on your system and allow you to perform instant searches for files from the KDE 3.5 K menu.

neo@deusexmachina:/$ locate ld.so.conf
/etc/ld.so.conf
/etc/ld.so.conf.d
/etc/ld.so.conf.d/libc.conf
/etc/ld.so.conf.d/x86_64-linux-gnu.conf
/etc/ld.so.conf.d/zz_i386-biarch-compat.conf

As you can see in this example, you may use wild-cards to search for files with certain extensions.

neo@deusexmachina:/$ locate "*.wad"
/home/neo/.chocolate-doom/savegames/doom.wad
/home/neo/.chocolate-doom/savegames/doom2.wad
/home/neo/.wine/drive_c/Program Files/Doom Builder/fbase6.wad
/home/neo/Documents/Cchest2.wad
/home/neo/Documents/O34S.wad
/home/neo/Documents/ahell.wad
/home/neo/Documents/base.wad
/home/neo/Documents/cube.wad
/home/neo/Documents/doom.wad

This is an example using grep to filter the results to just the /usr/bin folder

neo@deusexmachina:/$ locate "mplayer" | grep "/usr/bin"
/usr/bin/fvwm-crystal.mplayer-wrapper
/usr/bin/gmplayer
/usr/bin/mplayer
neo@deusexmachina:/$

The whereis command is used to locate various files on your computer and may be used to find out where a program is installed.

neo@deusexmachina:/$ whereis mplayer
mplayer: /usr/bin/mplayer /etc/mplayer /usr/bin/X11/mplayer /usr/share/mplayer /usr/share/man/man1/mplayer.1.gz

Last flight of the space shuttle and future space travel in doubt.


Space shuttle carried past the Washington Monument.

Space shuttle carried past the Washington Monument.

The Space Shuttle has made its last journey across country to the final resting place in a museum. This is a huge shame that America does not have any more interest in having regular expeditions into space, they are instead depending on other countries to carry their satellites into orbit, the heydays of space travel seem to be over, sure the New Horizons space probe is heading to Pluto to take photos of that supercooled planetoid and finally allow us to see what the surface is like with the tenuous methane-ammonia atmosphere and the supercooled ice surface. An astronaut in a spacesuit would not enjoy landing on Pluto, their suit would freeze solid and they would be a popsicle in no time. With a surface temperature of -233 degrees celsius, it is not the coldest object in the solar system, there are three dwarf planetoids outside the orbit of Pluto, making the solar system larger than we thought. We have discovered other stars that have planets in orbit, but some are super hot gas giants and others are rocky planets that are too large and would have massive gravity and would not be suitable for colonists at all. The Earth is perfect for life, it is in the Goldilocks zone orbiting the sun and we would need another planet to be comfortable and warm enough for life to exist so we could live without suffering a -90 degree celsius climate.

Mars could be terraformed eventually, it would take a long time, melting the polar ice caps, and freeing the water locked up in the permafrost would change the climate on the planet and allow us to use the water to get hydrogen and oxygen with simple electrolysis. Putting more carbon dioxide into the atmosphere would thicken it and allow the planet to get a little warmer. But the will to go into space has gone, everyone just wants to watch television and vote on American Idol instead of caring about spreading humanity out into the universe. We have spent half a trillion dollars on the Afghanistan and Iraq wars, that could have fed the poor and saved many people from diseases as well as funding a manned mission to the Moon. Instead we are just sending drones into the desert to kill innocent people and bomb so called terrorists in the name of national security. And the Disney corporation have created a show named Dog with a Blog! How could this idea be even more mindless, we have also have the stupid and brainless shows like Jersey Shore, which is still dumbing down the population after its inception. And in Australia, we are planning to create a show called The Shire, this will be as brainless and pathetic as the American version and add to the brain drain of the population. If an asteroid landed in the ocean and wiped out the Jersey Shore, this would be a great thing.

I would like to visit a Neutron star, the massive gravity, over 100,000,000 times Earth gravity would be amazing indeed, light is bent around a Neutron star by such massive gravity, you can see more than half the surface due to this fact, you could not approach too closely, but seeing one from a relatively close distance would be incredible. With the mothballing of the space shuttle, will they create another vehicle to replace it or will they just rely on the Russians to carry the satellites into space. The space shuttle looked incredible on the back of the transport plane as it was carried aloft to the destination; in the movie Superman Returns, they depicted the launching of the shuttle from the top of a plane, but this would not really work, the space shuttle requires the two solid-fuel rocket boosters and the huge Hydrogen tank to get into orbit. But the rescue scene in that movie was very entertaining, especially when the plane reached its zenith and the passengers were weightless. That was quite a cool scene too. Just like the vomit comet training plane that the NASA astronauts use. That type of plane was also in a James Bond flick, the same thing happened in that film, where the shuttle took off from the plane. Very unrealistic, why would it be full of fuel when in transit? But that is the movie industry for you.

Bussard Ramjet spaceship passing Mars.

Bussard Ramjet spaceship passing Mars.

Not as unrealistic as the Micheal, Bay films though. They are all explosions and giant robots. I would rather watch the original Star Wars films, they are actually lovely films, with the swashbuckling hero Han Solo, the Jedi and the heroine Leia Organa. Such films are not made these days, let alone the film noir gritty film Blade Runner. That movie is beautiful and has a great story of love and violence that shows that even artificial humans can experience feelings of love and the fear of death. If you only lived four years and your whole childhood was implanted memories then how would you feel? The opening scene with the spinners flying over the city and the pipes burning off gas in giant flames blasting into the sky is incredible. No movie made these days can approach the beauty of this movie in my humble opinion. Citizen Kane is another great film, that I hope never gets a horrible Hollywood re-make. James Cameron has re-made Titanic in 3D, that apparently worked well, but I have already seen that movie and do not wish to see it again. A Night to Remember is a better film about the sinking of the Titanic than the James Cameron film anyway. I loved Terminator II, the liquid metal animation of the T1000 was revolutionary at the time. Any modern computer can create incredible 3D graphics with advanced GPUs but in 1991, this technology was far more expensive.

Even a Trident 512 Kilobyte graphics card would have been expensive back then, the computers that created the morphing Terminator would have cost an unimaginable amount. It is amazing that the computers in the Voyager 2 probe are still working after all of this time, with the hand-woven magnetic core memory and other 1970s technology that was used in the construction of this space probe, it is more reliable than most modern computers. But it had to withstand the hard radiation in space and the other trials and tribulations of surviving in deep space. If you were in a electromagnetic ramscoop ship constantly accelerating at 1g; then you could reach the centre of the milky way galaxy in 25 years, but 75000 years would have gone by on Earth. But that type of vessel would subject the passengers to far too much radiation for conceivable survivability. Warp drive is another possible technology for deep space travel, but it would need far too much energy for any conceivable race to be able to harness it. The Alcubierre drive offers some possibilities, surrounding the space ship in a bubble of energy that insulates it from space-time, or stretching space behind the spacecraft and compressing it ahead of the spaceship, but it has been said that a warp drive would gather up a massive amount of radiation, and then release it at the destination planet when you arrived.

The obvious answer to this is to overshoot the planet and then stop just past the destination, then turn around and use thrusters to navigate to the planet. That would not matter, if the spaceship had travelled 300 light years to the planet, overshooting it by 3000 miles would not matter at all. Then you could send down a small shuttle to visit the surface of the planet. Then the radiation emitted would be shed harmlessly into space.