General Linux tips
Some general linux tips that are not obvious, known, and/or well documented, but still very useful.
Web
To search the web for Linux stuff, use
google's Linux search engine.
(Bourne-again) Shell - Bash
Nebenbei bemerkt: Die Taste <ctrl> (control) entspricht der Taste <Strg> (Steuerung) auf der deutschen Tastatur. Diese heißt NICHT String! ;-)
Software
- to run a program regularly with a certain interval, use watch:
watch command
will simply run "command" at default intervals of 2 seconds.
watch cat /proc/acpi/thermal_zone/THRM/temperature
will simply display the file /proc/acpi/thermal_zone/THRM/temperature every 2s,
which should make for a simple cpu temperature display on acpi-enabled 2.6 kernel
machines.
- Hate the vi editor? Try jedit - a powerful sourcecode editor that is free,
open source, and written in java (so it will run on your system after an easy installation). It makes UltraEdit, TextPad and the like look bad functionality-wise.
It also supports working with files via ftp and sftp (ssh) using easily installable plugins.
- Tired of the slow file finding utility "find" under Linux? Try "gnu locate" instead,
it uses a regularly rebuilt database of your filesystem to find files and folders very fast.
Remarks: "time" is used to measure how long the command runs. The output was piped to wc -l, which counts the lines of the output, i.e. how many times the pattern was found.
The filesystem this was tested on is an almost full 40GB drive with ~260k files.
A search for something that doesn't exist is very quick:
time locate laberrabarber | wc -l
0
real 0m0.271s
user 0m0.260s
sys 0m0.000s
(Doing this with "find" instead of "locate" takes about 7 minutes on my machine)
A query that returns a lot more results (in this case 20833) doesn't take all that much longer:
time locate test | wc -l
20833
real 0m0.285s
user 0m0.280s
sys 0m0.000s
Locate can also search for patterns, of course. To look for something containing "test" somewhere
below any directory called "include", try:
locate */include/*test*
Links