Usability Tips for UNIX

I want to note a couple of helpful hints I stumbled across. First, I learned something new about the xterm program. I run FreeBSD on many systems and start X manually with 'startx'. One system has Windowmaker for a window manager. When I launch an xterm, the new instance doesn't read .profile. This means the prompt stays with the default, rather than changing to suit my needs. For example, my .profile has this entry to change the prompt:

PS1='`hostname -s`:$PWD$ '

This creates a prompt like this:

drury:/var/log$

Unfortunately, prior to today I manually sourced the .profile to change the prompt, using '. .profile' in the user's home directory.

While perusing this Unix for Advanced Users guide, I came across this article: Is my .login or .profile being used?. It explained that I needed to start xterm with the '-ls' option to specify it running as a login shell. In that case it will read the user's .profile. Here is the menu command I use to start xterm:

xterm -ls -sb -rv -fg green -fn 9x15bold -geometry 80x24

The -sb creates a scroll bar; -rv specifies reverse video; -fg makes text green; -fn specifies the font; and -geometry sets the window size.

I also want to make note of a file that I use to set a resolution of 100x100 when X starts. My .xserverrc file looks like this:

exec /usr/X11R6/bin/X -dpi 100 -nolisten tcp

I can confirm this with xdpyinfo:

resolution: 100x100 dots per inch

A final usability issue involves batteries and FreeBSD laptops. This post to freebsd-mobile is part of a thread discussing differences between suspending and hibernating a laptop. I'm able to have my laptop suspend, thanks to the BIOS I believe. Read the posts for more information if interested.

Comments

Anonymous said…
If you're using bash you can save some resources:

PS1='`hostname -s`:$PWD$ '

is the same as:

PS1='\h:\w$ '

I prefer bash's method of sorting out if I'm root or not:

PS1='\h:\w\$ '

but my prefered prompt also shows me which user I am:

PS1='\u@\h:\w\$ '


Other shells probably have the same built-ins (zsh, etc.)
Anonymous said…
This comment has been removed by a blog administrator.

Popular posts from this blog

Zeek in Action Videos

New Book! The Best of TaoSecurity Blog, Volume 4

MITRE ATT&CK Tactics Are Not Tactics