To access the contents, click the chapter and section titles.
Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98
Chapter 17 Command Toolbox: Useful Shell Commands and Shortcuts
In This Chapter
- User Utilities
- Finding Files
- Text and File Utilities
- Splitting Files into Smaller Files: split
- Accessing a Computer Through the Network: telnet
- Working on the Console: setfont
- UNIX Printing Primer
- UNIX Text Processing
This chapter introduces a number of basic tools and command line programs that you can use while working on the shell. There are many more tools available, but these are some of the more basic ones. You have already learned a few in each category. Although this chapter is not comprehensive, it will give you an idea of what you will find. Many more tools are availableso many, in fact, that it could be the topic for an entire book.
User Utilities
Every once in a while during the course of your work, you will want to change your password, change your shell, find files, search files, and so on. Here are some commands to help you.
Changing Your Password: passwd
Use the passwd command to change your password. Because the command is interactive, it will ask you for your current password (to ensure that some other user doesnt change your password while you are away from your computer) and then for a new password. After successful confirmation of your password, it is accepted by the system. Note that passwords are never echoed to the screen to avoid being spied by nearby eyes, as in the following code:
[alberto@digital alberto]$ passwd
Changing password for alberto
(current) UNIX password: ********
Enter new UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully
The superuser (root) can use the same passwd command to change any password in the system. When the superuser provides a username as an option to the command, he or she can change the password for any user in the system. The superuser does not need to authenticate the users password. Changing a users password as the superuser would look like this:
[root@digital /root]# passwd alberto
Enter new UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully
Changing Your Shell: chsh
If you dont like your shell, you can use the chsh command to change it. Only shells listed in /etc/shells are acceptable for use. It can be used interactively, like this:
alberto@digital alberto]$ more /etc/shells
/bin/bash
/bin/sh
/bin/ksh
/bin/csh
/bin/tcsh
[alberto@digital alberto]$ chsh
Changing shell for alberto.
Password: ********
New shell [/bin/tcsh]: /bin/bash
Shell changed.
If the shell you like is not listed, add an entry to the /etc/shells file, and then youll be able to set it.
Changing Personal Information: chfn
The chfn (change finger name) command changes additional information about yourself, such as your full name, office address, and office and home phone numbers. This information is accessible using the finger command (which is typically disabled in most systems because it poses certain security risks). It is used by some programs to determine your full name and other information. The chfn command, like the passwd command, is interactive:
[alberto@digital alberto]$ chfn
Changing finger information for alberto.
Password: **********
Name [Caldera OpenLinux User]: Alberto Ricart
Office []: Rm. 3210 Left Wing
Office Phone []: 800 555 1212 ext 800
Home Phone []: not listed
Finger information changed.
Whos on the System: who and w
The who and w commands can be used to see who is logged into the system. The w tells you who is logged on and what they are doing:
[alberto@digital /etc]$ w
17:17:07 up 5:42, 2 users, load average: 0.05, 0.13, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
alberto tty1 11:51am 5:25m 33.95s 0.13s xinit
/etc/X11/
alberto ttyp0 192.168.0.10 5:07pm 1.00s 0.50s 0.08s w
The who command simply tells you who is logged into the system:
[alberto@digital /etc]$ who
alberto tty1 Sep 20 11:51
alberto ttyp0 Sep 20 17:07 (192.168.0.10)
Both these commands point out who is logged in through a remote terminal. The FROM column in the w command (the first example in the previous section) lists the IP address of remote users. The who command also displays the address of remote users between parentheses.
|