Let's see a small example of a for cycle directly inside the shell:
me@ubuntu:~/workspace/myFile$ for file in *
> do
> echo $file
> grep foo $file
> done
test.txt
hi, my name is foo
In this case we will cycle all the files in the current directory, print out their names and grep "foo" for each one. Of course you can simply make recursive grep with * as file input parameter... but this can be a startup point for more complex operations
Thursday, January 31, 2008
Thursday, January 24, 2008
How to enable speed step on core 2 duo
Before starting we have to discover which governors are avaiable for our processor:
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
The output should be something like this:
powersave ondemand conservative performance
Considering that in Ubuntu Gusty scaling is supported directly by the kernel we will to do nothing else than load the following modules:
cpufreq_conservative
cpufreq_ondemand
cpufreq_powersave
acpi-cpufreq
To do this we have to add the previous lines to the modules file:
$ sudo gedit /etc/modules
Now we can reboot the machine and enjoy the speed stepping. To set a specif governor we can type cpufreq-selector -g {governor}, here there is an example:
$ cpufreq-selector -g ondemand
We can also add the CPU frequency scaling monitor. To do this right click on the top panel and select Add to panel. Now we can drag & drop the gnome applet. To be able to change the governor from the applet we have to type the following command:
$ sudo chmod +s /usr/bin/cpufreq-selector
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
The output should be something like this:
powersave ondemand conservative performance
Considering that in Ubuntu Gusty scaling is supported directly by the kernel we will to do nothing else than load the following modules:
cpufreq_conservative
cpufreq_ondemand
cpufreq_powersave
acpi-cpufreq
To do this we have to add the previous lines to the modules file:
$ sudo gedit /etc/modules
Now we can reboot the machine and enjoy the speed stepping. To set a specif governor we can type cpufreq-selector -g {governor}, here there is an example:
$ cpufreq-selector -g ondemand
We can also add the CPU frequency scaling monitor. To do this right click on the top panel and select Add to panel. Now we can drag & drop the gnome applet. To be able to change the governor from the applet we have to type the following command:
$ sudo chmod +s /usr/bin/cpufreq-selector
Subscribe to:
Posts (Atom)