![]() |
|
| Daemon News Ezine | BSD News | BSD Mall | BSD Support Forum | BSD Advocacy | BSD Updates |
Aliasing is important for any-size networksby Jonathon McKitrick <j_mckitrick@bigfoot.com>If you run FreeBSD on a box of your own, you are a system administrator. The same applies to Windows, but the fact is, you can never have the amount of control over Windows as you can have over FreeBSD and other Unix-like operating systems. What does this involve? Well, most system administrators would tell you they maintain software packages, add and remove accounts, and manage printer and file sharing. And of course they deal with occasional problems. Many of these duties apply to installations with only one primary user. Let's consider some examples of how we can perform some of the same duties as a system administrator on our little (or not so little) FreeBSD boxes at home, and how we can use operating system features to make our job easier. Simply put, most home users don't need to worry about adding and removing accounts. But, they can apply the other principles of system administration. First, let's consider a few shortcuts that can make day-to-day operations easier. Here is my alias list, in part: alias mc="midc" Like I said in my last column (my first?), I use Midnight Commander for some file managament. In linux, it is called 'mc', but under FreeBSD it is midc, so I just alias it as 'mc' for brevity. I also have aliases for vim, my editor, startx, three types of 'ls' with different arguments, and even 'al' to list my aliases to a pager. I also took some well-known advice for even the most sure-handed of system administrators: alias rm, cp, and mv to contain '-i', which requests confirmation for each file. If I need to delete a large number of files, I either use Midnight Commander, or you can specify the path as /bin/rm and the alias is sidestepped. I also include an alias 'o' to power down and turn off my laptop. Last in this group are two aliases, 'prof' and 'conf', which call vim to edit my z-shell shartup settings and my kernel config, respectively. There are also aliases for all my telnet/ssh connections and to connect to and disconnect from my ISP dialup account. That leaves several aliases for mounting and unmounting filesystems. Filesystem management is very important in both large and small installations. Here I have aliases for mounting my zip drive on /mnt/z in either DOS mode ('dz') or UFS mode ('z'). To unmount, I use 'uz'. Floppies are mounted on /mnt/a with 'flp' and unmounted with 'uflp'. That brings us to an important point: unless you want to 'su' to root for these filesystem mount commands, you need to take an extra step in your system startup. In /etc/rc.local, I added the following lines: sysctl -w vfs.usermount=1 This line allows non-root users to mount/unmount filesystems. But first, you have to own, or rather 'chown' them: chown jcm /dev/da0 Lastly, the 'plist' alias comes in very handy. The command is actually: pkg_info > /home/jcm/admin/pkg_list When I start wondering where all my drive space is going, I can run this command and then peruse 'pkg_list' to see what I have installed. And then I start playing the Grim Reaper of ports. With this list in one Xterm, I open another and use Midnight Commander to peruse /var/db/pkg. For each package that I might not want anymore, I go into the directory bearing its name, and read 'REQUIRED_BY,' if there is one. This file obviously lists other packages that depend on this one. So, I either have to leave it, or I can delete the parent port that uses it, then come back and delete this one. To delete a package quickly, I back out to /var/db, place my cursor on the package name, and type 'pkg_delete ' (don't forget the space) and then ESC-enter to copy the package name onto the command line. Hit return, if there are no dependency issues, the package is removed. Sometimes there are warning messages, but this often occurs if part of the port has already been removed, and some of its directories or files no longer exist for this reason. There is a command to force removal even if there ARE dependency issues, but I'll wait until I am more advanced before I start making assumptions about which commands I should force and which I should not. Remember: If you install ports rather than packages, you need to 'make clean' in /usr/ports to clean up the work directories. There can be a good deal of space hiding in those work directories. This also applies to /usr/src after 'make buildworld' as well. What are some tips for making world and cvsup'ping? What other tools and tricks can we use? Well, let's leave those questions for next time. |