Unix Tweaks
Every computer owner has their own preferences as regards how the user interface looks and functions.
This is one of the great aspects of computing: the almost infinite range of tweaks one can use to stamp our own individuality and quirks on the system
At first glance, one might think there's not a lot can be done to a command line interface to make it more user friendly.
Certainly there's less scope than with a graphical interface like KDE, but there are still little usability tweaks one can perform. Here are some of the ones I have developed over time..
Quick ls / custom scripts directory
I don't know how many times I type ls -la during the course of a login, but it's a lot more than I want to. I have already mentioned the use of aliases to shortcut this command to a single character, but here's another way of achieving the same effect and taking it to the next level.
I have written a number of custom scriptlets which I tend to use across all my Unix systems. So when I build a new box I need some way to get all these copied across with the minimum of fuss. The easiest way to do this is to keep them in their own custom script directory. So one of the first things I do is create /sc - straight off the root directory, nice 'n' short..
The only clincher here is that these scripts must be runnable from anywhere in the directory tree, which means the /sc directory must be in the system path. The path statement is typically taken from the user's system credentials during logon, specifically files like .profile which every user should have in their home directory.
After changing to my user's home directory - /home/andym (change your username/homedir accordingly) I edit the PATH line in .profile to include the above /sc directory, by adding the directory followed by a colon thus:
PATH=/sc:/sbin:/bin:...etc..
This will ensure that the scripts directory is put into the system path on logon. While I'm in this file, as I always log in as the user andym and then always su to root, I add the command su to the end of this file on its own line. This will automatically run the su command for me. Finally, save and exit .profile.
From now on all custom scripts are stored in /sc. First script off the rank is the one I simply call l (small L). The script only contains two lines..
ls -la
pwd
Save and exit
chmod 755 /sc/l
Thus by typing l from anywhere in the system I get a directory listing plus confirmation of the containing directory path. Note you must logout and login again for the above to take effect. Coolerino..
Quick Summary
Login as root..
mkdir /sc
chmod 775 /sc
cd /home/andym
vi .profile
Add PATH=/sc: and put su at end of file
vi /sc/l
Add ls -la
pwd
Logout and login
Custom prompt for root
This is partly covered in more detail in Prompt, Setting but I use a slight variation, which assumes you're using the BASH shell. Create and edit a file called .bashrc in root's homedir..
cd
vi .bashrc
..and add the line..
PS1="[\u@\h] $ "
Note the spaces around the $ sign. Save and exit. This will give a username@hostname prompt.
- A.
|
|
|