Linux Tweeks/Mods

Linux Tweeks/Mods

Useful Aliases

I find these to be particularly useful

alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias grep='grep --colour=auto'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias lt='ls -tr'
alias lf='ls -d */'
alias lfa='ls -d .*/'
alias lll='ls --full-time -iSr'

Awesome Commandline Calculator e

This program is soo sweet simply because you just type "e [expression]" into the commandline like you would think you could always do for a simple calculator, but never could before!

A Sweet Little Statistics Program st

I made this program to show me some specific computer stats at the stroke of a few keys. It is a commandline kind of GkrellM but doesn't log anything. It is designed in functions so you can mix and match what stats are shown on default. Of course it is taylored to my computer so you would have to change a few path names and such. It uses the program "e" above so put it in your /usr/local/bin/ directory. Here are the options:

Usage: st [option]
No Options: show some critical system stats
Only Single Options:
d . . . . [date]
u . . . . [uptime]
mp . . . .phase of moon [pom]
-t . . . .temperature /proc/acpi/thermal_zone/THM/temperature
-b . . . .battery /proc/acpi/battery/BAT0/info ./state
c . . . . CPU loadavg
-c . . . .CPU percentages /proc/stat
-m . . . .mem
-s . . . .swap
-p . . . .top 4 processes ps
-n . . . .bytes in/out /proc/net/dev
-i . . . .tcp stats, [netstat -pl]
-d . . . .diskstats(disk) read/write

Only the options with a hyphen are valid options, the rest are so plainly simple it would be more intensive to run them through this script than to run them directly. The reason this program can only take one option is because I suck at parsing the commandline in bash scripts

Bash Macros

The volume keys on my Laptop don't seem to work for me so I just made a macro tied to the page up and page down keys to run the command "aumix -v +5; aumix -q" and "aumix -v -5; aumix -q" repectivly. How I did this was to find the ascii equivalent code of the keys by running "showkey -a" and pressing the key. Then I placed the macro in the /etc/inputrc file. Here is the last few lines of my inputrc file:

# alternate mappings for "page up" and "page down" to change volume
"\e[5~": "aumix -v +5; aumix -q\n" #page up up volume
"\e[6~": "aumix -v -5; aumix -q\n" #page down down volume

#use showkey -a for codes
"\e[20~": "mpc next\n" #F9
"\e[21~": "mpc status | head -n2\n" #F10
"\e[23~": "mpc toggle\n" #F11
"\e[24~": "mpc playlist\n" #F12
"\e[12~": "st -n; st -i\n" #F2 netstats
"\e[13~": "st -t; st -b\n" #F3 temp and batt
"\e[[B": "st -n; st -i\n" #F2 for the VTs
"\e[[C": "st -t; st -b\n" #F3 for the VTs
"\e[19~": "mpc seek +10\n" #F8
"\e[18~": "mpc seek -10\n" #F7
"\e[[A": "tail -n18 /etc/inputrc\n" #F1 for the VTs
"\e[11~": "tail -n18 /etc/inputrc\n" #F1 help on Bash macros

All of these macros must be before the $endif
You may be wondering why I have the same macro for different keycodes, for some reason in a Virtual Terminal the ones you get when you hit ctrl+alt+F1 for example have a different keycode than in X.
Some of my macros show me computer stats with my program "st" as described above, and the others are for my music playing demon, called "mpd" and the command "mpc" controles it. What I like so much about this music demon is that it can be easily scripted and it runnes entirely in the background, so you don't need a window open. I just hit F10 if i want to know what song is playing.

Showing Lyrics for Music playing through mpd lyr

Usage: lyr [OPTIONS]
cats lyrics to currently playing song from mpd using mpc
Lyric files are in the same directory as song with same file name with an extention of [.lyr]
.lyr files are Plain Text files and can be displayed using more or less

-e edit the lyrics to currently playing song with nano
-l uses less -r to view lyrics
-m uses more to view lyrics

No Options: uses cat to view currently playing song

So if I have: ~/Music/Artist/Album/song.mp3 then the lyrics for that song would be ~/Music/Artist/Album/song.mp3.lyr of course you would have to obtain all the lyrics and save them as such for this program to work, but if you enjoy lyrics as much as I then it is worth it. All you need type is lyr and you get the lyrics cat to your screen