Tip #480 Diff Two Directories
A quick script to compare files from two directories (for example a backup and working directory).Read more »
Tip #445 Local/remote webserver
Serve files on port 8080 for anybody from the directory from where you start this command::;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`
";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done Read more »
Tip #412 Vi mode in bash
Add "set -o vi" at the bottom of ~/.bashrc or /etc/bashrc, then press ESC in prompt to enter vi mode and search your issued command in history by giving a "/" at front.For example, in shell command line, press ESC, type /ls, enter. Read more »
- TAGS:
- bash
Tip #403 list the most recent files in a directory
If you just want to find out what's new in a directory:Read more »
- TAGS:
- bash
Tip #387 Deleting whole words on a bash command line
To delete a word on a bash command line, hit ESC then backspace. Read more »- TAGS:
- bash
Tip #377 Alter autocompletion settings
Try changing the following in your ~/.inputrc to alter the behaviour of auto completion on application/file names:set completion-ignore-case on
- performs filename matching and completion in a case-insensitive fashion. The default value is 'off'.
set completion-query-items 200
- number of possible completions that determines when the user is asked if they want to see the list of possibilities. The default limit is 100.
show-all-if-ambiguous
- if set to 'on', words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell. The default value is 'off'.
visible-stats
- if set to 'on', a character denoting a file's type is appended to the filename when listing possible completions. The default is 'off'. Read more »
- TAGS:
- bash
Tip #376 Change prompt color dynamically
I'm frequently logged into multiple different boxes concurrently. To help me keep track of which box I'm working on at the moment, I have this in my .bashrc file, which I keep rsynced across the various boxes.Read more »
- TAGS:
- bash
Tip #375 Bash function to decompress archives
From dotfiles.org; original author unknown:Read more »
Tip #362 Tar remote dir over SSH
If you work on remote boxes a lot, you ll probably need a to backup a directory from there onto your machine sooner or later.. This can easilly be done using ssh & tar; all in 1 line of (script friendly) code:Read more »
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs