Posts Tagged ‘type 3a’

How to change hostname permanently on Debian and Ubuntu Linux

Thursday, March 14th, 2013

Change hostname on Debian and Ubuntu Linux terminal hostname screenshot

I had to configure a newly purchased dedicated server from UK2. New servers cames shipped with some random assigned node hostname  like server42803. This is pretty annoying, and has to be changed especially if your company has a naming server policy in some format like; company-s1#, company-s2#, company-sN#.

Changing hostname via hosts definition file /etc/hosts to assign the IP address of the host to the hostname is not enough for changing the hostname shown in shell via SSH user login.

To display full hostname on Debian and Ubuntu, had to type:

server42803:~# hostname
server42803.uk2net.com

To change permanently server host to lets say company-s5;

server42803:~# cat /etc/hostname | \
sed -e 's#server42803.uk2net.com#company-s5#' > /etc/hostname

To change for current logged in SSH session:

server42803:~# hostname company-s5
company-s5:~#

Finally because already old hostname is red by sshd, you have to also restart sshd for new hostname to be visible on user ssh:

company-s5:~# /etc/init.d/ssh restart
...

As well as run script:

company-s5:~# /etc/init.d/hostname.sh

Mission change host accomplished, Enjoy 🙂

Improve your night sleep (Insomnia) on Linux with redshift

Friday, February 15th, 2013

sleep better at night while using Linux with redshift command line and gui applet / improve your insomnia while being a linux user
For a while I've been experiencing troubles with getting asleep. As I work in the field of IT already for 10 years and with time it seems the problem is accelerating. I've read on the internet a lot on the topic of getting asleep and how this relates to computers and computer equipment use and came to the conclusion one of the main reasons I have troubles getting asleep is I use computer late at night usually I use PC until 2, 3 o'clock. Then when I go to bed, I cannot fall asleep until its early in the morning usually 6, 7 in the morning. My main operating system on notebook is Linux so almost all of the time I use Linux. I've noticed when I occasionally use Windows, my eyes tend to be less strained afterwards and I sleep better. Thus I suspected there should be some kind of tool in Linux which changes how PC screen displays to make eyes more relaxed. I didn't have the time to research seriously and before some time the little research I've done on this led me to nothing. Just a week ago, I've read one of the articles in Linux Magazine (December) issue, there is a very thorough article in it on how to avoid headaches and eye strain using a tiny tool which changes monitor screen gamma called redshift. In this article will explain in short how to install and use redshift to make your PC work less stressful and improve your sleeping at night. I'm using Debian as a basis Linux distro and thre redshift is available via package, other deb derivatives Ubuntu, Xubuntu etc. aslo have it. For Fedora and most of other Linux distributions redshift is also available from default repositories. For those who use Slackware or some older Linux distributions, redshift has to be installed manually from source but this should be trivial.

1. Install Redshift and Redshift-gtk packages

To install on Debian and Ubuntu:

# apt-get –yes install redshift redshift-gtk

On Fedora install with yum:

# yum -y install redshift

After installed you will have two programs to tune the screen color temperature, one is console based ( redshift ) and the other one is GUI based ( gtk-redshift ).

redshift-gtk is a GUI frontend

Here is a list of redshift tool options:

2. Changing color gamma with redshift

hipo@noah:~$ redshift -h
Usage: redshift -l LAT:LON -t DAY:NIGHT [OPTIONS...]

Set color temperature of display according to time of day.

  -h        Display this help message
  -v        Verbose output

  -g R:G:B    Additional gamma correction to apply
  -l LAT:LON    Your current location
  -m METHOD    Method to use to set color temperature (randr or vidmode)
  -o        One shot mode (do not continously adjust color temperature)
  -r        Disable initial temperature transition
  -s SCREEN    X screen to apply adjustments to
  -t DAY:NIGHT    Color temperature to set at daytime/night

Please report bugs to <https://bugs.launchpad.net/redshift>

To set your screen to Reddish mode which will relax your eye strain and therefore – when you go to sleep you have a better sleep, type:

 hipo@noah:~$ redshift -l -35:-56 -t 5000:3300

Other monitor red-color afternoon or night time gamma to relax your eyes is;

hipo@noah:~$ redshift -l 52.5:13.4

3. Setting redshift to auto change screen gamma via cronjob

If you prefer automatically changing color gamma to reddish at night – will make your eyes (and hence organism) less alert set as a cronjob in lets say 22:00 o'clock at night;

 hipo@noah:~$ crontab -u root -e

00 22 * * * redshift -l -35:-56 -t 5000:3300 2>&1 >/dev/null

4. Controlling manually between standard and reddish color gamma through gtk-redshift

For people who like to control and switch between color gamma using GNOME Applet run gtk-redshift like so:

hipo@noah:~$ gtk-redshift  -l 52.5:13.4

gtk redshift gnome applet screenshot Debian Linux

Clicking on the icon of redshift the color gamma gets changed to red, another toggle reverses back to normal.

There is another tool called F.lux which does the same as redshift. F.lux precedes redshift, actually redshift author write it as attempt to create superior F.lux. Flux works on Windows and Mac OS X – so users who work at night on this platforms might want ot check it. I tried installing f.lux on my Debian Squeeze Linux but had troubles because of requirement for newer python-appindicator :

noah:/home/hipo# apt-get install fluxgui
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 fluxgui : Depends: python-appindicator (>= 0.0.19) but it is not installable
E: Broken packages

 

Probably with some tampering I can make f.lux work but I was lazy and since I already had redshift, I decided to quit and just be a happy redshift user.