Posts Tagged ‘bash’
2010
10.21
Tags: bash, gzip, search, zcat, zgrep
Posted in bash, code, linux, sysadmin | No Comments »
You knew it already – but I keep forgetting – the power of zgrep and zcat both of which behave as their z-less counterparts.
So, to search a gzip’d file, you can simply zgrep <term> <filename.gz>, or to cat/view it, zcat <filename.gz>
Good to come back to in case of impending forgetfulness…
2010
07.14
Tags: backup, bash, compression, gzip, locking, mysql, mysqldump, on the fly, pipe, tar
Posted in bash, code, Did you know, mysql, sysadmin | 1 Comment »
Just to jot it down lest I forget:
Tar’ing the local directory and streaming the tarball straight to gzip:
tar cvf - . | gzip > target.tar.gz
MySQLdump’ing directly to gzip: (more…)
2010
06.28
Tags: 7za, 7zip, backup, bash, gzip, keyless ssh, login, scp, ssh, tar
Posted in bash, code, linux, sysadmin | No Comments »
It’s a simple one-liner that one tends to forget (that is, one that I forget as I untar more than I manually tar). So creating a tar file from directory and all subdirectories is as simple as
tar -cvf file.tar directory (more…)
2010
06.19
Tags: bash, Mac, port forwarding, putty, ssh, terminal, tunnel, windows
Posted in bash, code, linux, mysql, security, sysadmin, windows | No Comments »
Assuming you have a Windows machine and you interact with Linux boxen at any stage, chances are high that you have used and interacted with PuTTY at one stage or another. That beautiful, less than 2 sec, 444K download of a tool (currently at version 0.60 beta) allows you to SSH, COM-direct, RSH, Telnet etc from the desktop. Both examples below relate to MySQL port tunneling.
SSH Tunnels using the Bash command line
Running on a proper machine (or even a Windows with Cygwin or a Mac Terminal) allows you to quickly tunnel a session to a remote server: (more…)
2010
05.31
Tags: bash, howto, install, sh, ubuntu, webmin
Posted in bash, code, Did you know, linux, sysadmin | No Comments »
Just a quick note (as I keep forgetting, and a cut-and-paste solution is a quicker time to market) – but you knew that already. Installing Webmin is quite simple (download directly, or from the mirrors). Currently, 1.510-2 is the latest version – check on www.webmin.com for further details. As an aside, the book Webmin Kompakt – by Holger Reibold – is available for download!
So here’s a simple step-by-step: (more…)
2010
04.25
Tags: bash, command line, Exchange, imap, pop3, shell, telnet
Posted in bash, code, linux, sysadmin, windows | No Comments »
It’s quite simple, really: POP3 (Exchange, dovecot etc) you know, IMAP (Exchange, dovecot, courier etc) you know — so this is just a recap, right? You know how to telnet into the machine — in Vista or Windows 7, you may need to install it separately using “Add/Remove Programs”, or just use Putty in Telnet mode… otherwise, apt-get install telnet if it’s not on your machine (or yum install telnet)
POP3:
telnet SERVER 110 (more...)
2009
09.08
Tags: bash, delete, divx, linux, mp3
Posted in bash, code, linux, open source software, sysadmin | No Comments »
So you want to run a script that removes all mp3 and avi files off the filesystem. One way (in bash) as below. Comment, suggestions and feedback are welcome
Using $EUID to check for root user, and $IFS to check for line breaks as the file names has spaces in them. IFS is saved to a temp variable, reset and then re-instated afterwards. C is the counter. Got two litte for loops in bash with backtick execution.
(more...)