Tuesday, July 16, 2013

Console2 - a better windows shell


It seems that the windows world is not as enamoured with the shell (terminal) as the Unix/Linux world. One of the first things i do on my Windows box is install Cygwin as the tools are absolutely fantastic. However, the smaller open source community of the Microsoft world hasn't produced much in this regard.
... please prove me wrong, I'm a Microsoft fan...

So, I spent a good while looking for a better Windows shell. All I wanted was to be able to Cut&Paste like the rest of my apps and have tabbed windows that allow me to use my various shells like
  • Command Prompt
  • cygwin
  • Git  Bash
  • PowerShell
  • Visual Studio Command Prompt
  • MongoDb Shell
  • NodeJs
Thankfully that is exactly what i found in Console2 - available for download  from Sourceforge.



What we get here is an easy to use shell that allows you to create pre-defined tabs with environmental variables set to launch the individual environments that you may need.

There is no install utility, so simply unpack the executables to a folder and add that folder to your command path.

To add a new shell: goto Edit>Settings and click on Tabs and add tab for each environment that you want. 

These are the settings U use for a few of the shells mentioned above. FOr most you just point to their installation folder, but some need a few extra commands (like Visual Studio command prompt)


GitBash
Title:            GitBash
Icon:            C:\Program Files (x86)\Git\etc\git.ico
Shell:            C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
Startup Dir:   c:\code

Visual Studio Command
Title:            VS Command
Icon:            
Shell:            %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
Startup Dir:   c:\

Powershell
Title:             Powershell
Icon:            
Shell:            %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
Startup Dir:   c:\code







Wednesday, June 12, 2013

Rotate your Ubuntu Logfiles

Running out of diskspace coz you over-log?

Well first, there are never too many logs!

Managing your logs is the trick. In ubuntu there's a service/daemon that manages this for you called rsyslog, that will ensure your logs are kep in order. The service will delete logs that go stale according to the settings in the config file. Below the process "syslog" is rotated daily, that is every day a new file is created and a index number appended onto the end of the file. The rotate value is set to 2, which means only hold 2 rotated logs and delete the rest. The other services in the config file are set to weekly rotation and to be rotated every 4 weeks.

# Edit the config file
sudo nano /etc/logrotate.d/rsyslog

/var/log/syslog
{
        rotate 2
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
                reload rsyslog >/dev/null 2>&1 || true
        endscript
}

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                reload rsyslog >/dev/null 2>&1 || true
        endscript
}

# Restart the service
sudo service rsyslog restart