review101LinuxHacks
Table of Contents
1 Review 101 linux hacks
Having just downloaded TheGeekStuff's 101 Linux Hacks it seems like a good idea to do a quick review. Is each useful, does it lead somewhere, is there something really new, etc… So, here goes:
**
- CDPATH – by all means, pushd works, added "cdp" function
- cd Alias – functions still better
- function mkdircd – good idea, use "command cd" inside overwritten function cd
- toggle directory – see next idea, better
- directory stack – "dirs" not on all unix, peekd, swapd, etc.., addl functions
- shopt -s – with cd, what other commands?!
**
- grep – hardly a hack, but worth promoting
- grep with RE – ditto
- find – ditto grep
- supress stdout, stderr – functions ignore, quietly
- join – by all means, and see /rdb
- change case – functions UC lc toupper, tolower, take stdin OR args
- xargs – see find, and notice it only works with commands, alt: cmmd $(stuff)
- sort – see grep, find, xargs
- uniq – ditto
- cut – learn awk instead
- stat – yes, and time to introduce "set – $( … )"
- diff – again, sort, uniq, grep, find, xargs
- ac – Sys admins info, specialty. not the general audience
- background – direction of systems programmer, more general info
where "watch" must be linux-specific. rather a "forever" loop function
- sed – list grows: diff, sort, uniq, grep, find, xargs
- awk – now we're getting somewhere; but, again NOT a "hack" per se.
- vim – fun stuff, but the other dimension.
- chmod – NAH, "Not A Hack"
- tail – yes, wrap the "watch" idea, not only admins, but systems, anyone
- less – see "more", "view",
- wget – i'll learn something here.
1.1 SSH Commands and tips
1.2 Date manipulation
- set date – sysadmins
- set hardware – sysadmin
- date format – should use %{a-zA-Z}, 4th e.g. ff
- past date – -v{+-}…
- future date – s/a above,
1.3 PS{1..4} PROMPT_
- PS1 – yes, .profile
- PS2 – yes, continuation prompt
- PS3 – no, K&P's "pick" command is both more general, and as simple
- PS4 – yes, by all means; default: '+ ' is sufficient for functions; see traceall
- PROMPT_ – yes, and need to escape the '$' in any command
- custom PS1 – see *-5, so, what's the value of PROMPT_ ?, value of command output is high
- color PS1 – yes, FUN
1.4 Archive and Compression
- zip – see find, grep, sed, … etc NAH
- zip++ – nice to know (about)
- zip w/password – again, ntka
- tar – more NAH
- zip1 – unstick the tar,
- bz – NAH, alternatives to
- cpio – yet another file archive. my favorite, actually
1.5 Command Line history
- bash history examples – fav function: ngh () { history | grep $*; }
* control R -- this is NEW info
2 Links
http://www.youtube.com/watch?v=_oYH9nRauRM MrTutorize use of "set –" http://www.youtube.com/watch?v=NflZf41fmYM MrTutorize function introduct
Footnotes:
1
DEFINITION NOT FOUND.