Monthly Archives: August 2011

Linux – Terminal system info, cheat sheet

This is a small collection of commands that can give you information on a Linux computer.
Most of this commands can be run as non-privileged user, but more information can be obtained if (and should be) run as root:

General system information:

# uname -a

List all hardware

lshw |less

Alternative with Gtk frontend
Read more »

Linux – How to create and remove a soft link, symlink or symbolic link

A soft link, or more common, a symlink, is link a shortcut to the targeted file or directory. So when is removed the original target stays present. This is the opposite of a hard link which is a reference to the target and so, if the hard link is removed, so is the target.

A symlink can be created like:

ln -s /path/ linkname

from the ln man pages:

ln [OPTION]… [-T] TARGET LINK_NAME (1st form)

-s, –symbolic
make symbolic links instead of hard links

To remove a symlink

rm linkname

What is important here is to note that the command doesn’t have the trailing slash:


$ rm linkname/
will output the error:
rm: cannot remove `linkname/': Is a directory

$ rmdir linkname/
will output:
rmdir: linkname/: Not a directory

 

HTML – Prevent js and css files from being cached

By default, external files such as javascript and css are cached by the browser. If you want to prevent this from caching, simply use this easy tip:

<link href="/stylesheet.css?<?php echo time(); ?>" rel="stylesheet" type="text/css" />

The result will look like this:

<link href="/stylesheet.css?1334567890" rel="stylesheet" type="text/css" />