Unix tips !
This is a list of tips related to the general use of Linux; if some subjects can be properly extended they will probably evolve into articles.
- delete all the backup files:
find / -name "*.bak" -o -name "*~" -exec rm "{}" ";"
- if you are monitoring some log files (ex: Apache's logs) and you want to filter the output by a string (e.g. user_name):
tail -n 30 -f /var/log/apache/access_log | grep "search_string"
- howto retrieve information about a file/command
whereis <command> - locates the binary, the source code and the manual page; example:
whereis gcc gcc: /usr/bin/gcc /usr/man/man1/gcc.1.gz /usr/share/man/man1/gcc.1.gztype <command> - displays the type of files; example:
type set set is a shell buildin type gcc gcc is /usr/bin/gccfile <command> - display the type of file based on its content; example;
file /dev/hda1 /dev/hda1: block special (3/1) file /dev/ttyS0 /dev/ttyS0: character special (4/64) file ./mydoc ./mydoc: directory file ./READ ./READ: ASCII text