You are not logged in.
Pages: 1
For game I did these alias / commands... as newbbie.
alias get-governor-available=' cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors '
alias get-governor=' cpupower frequency-info | grep "Il gestore" | awk '\''{ print $3 }'\'' | sed s/\"//g '
alias get-cpu-sched=' dmesg | grep -i "CPU scheduler" | awk '\''{print $6 " " $9 " " $10 " " $11 " " $12}'\'' '
alias get-cpu-sched-avail=' dmesg | grep -i "io scheduler" | awk '\''{print $8}'\'' | sed ":l; N; s/\n/ /; tl" '
alias get-io-sched-all-device=' cat /sys/block/sda/queue/scheduler '
alias get-io-sched=' cat /sys/block/sda/queue/scheduler | cut -d "[" -f2 | cut -d "]" -f1 '
alias get-io-sched-avail=' cat /sys/block/sda/queue/scheduler | sed "s/\[//" | sed "s/\]//" '
alias get-sync-clock='(timedatectl status | grep -q "System clock synchronized: yes") && echo -e "Clock: \e[1;39;41mSync\e[0m" || echo -e "Clock: \e[1;39;41mNot Sync\e[0m"'I wanted to get cpu governor, cpu scheduler, io scheduler.
Last edited by simona70 (2018-04-15 19:36:44)
Offline
Is there a question?
If you want to improve those, I'd *strongly* suggest you trim all the redundancy. Piping through grep through awk and to sed is ridiculous. Sed or awk alone could do everything there on their own.
EDIT: and piping from sed to sed is even worse! Note the following four produce equivalent results. Only one or two of them are good; one is horrific:
command | sed 's/\[//' | sed 's/\]//'
command | sed 's/\[//;s/\]//'
command | sed 's/[[\]]//g'
command | tr -d '[]'Oh, and when "command" is just `cat $file` ... that's also pointless:
tr -d '[]' < /sys/block/sda/queue/schedulerhttp://porkmail.org/era/unix/award.html
Last edited by Trilby (2018-04-13 18:59:38)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
And? Your question is?
Moving to NC...
Offline
Thanks for tips.
Offline
Pages: 1