|
Project: Linux Howtos
Starters for Linux - Part 3
By Trevor Warren <trevor@freeos.com>
Posted: ( 2001-02-16 06:04:10 EST by )
The third part of this series looks at some of the commands that deal with basic file administration and Networking.
Starters for Linux - Part 3 Hi friends! Welcome to the third and final segment of our journey through Linux CLI. We’ll wrap up this series by looking at a number of commands that deal with Basic System Administration and Networking. Basic System Administration Commands printtool (as root in X-terminal) Configuration tool for your printer(s). To access the settings directly go to the file /etc/printcap. setup (as root) Configure the mouse, soundcard, keyboard, X-windows, system services. Works only on Red Hat Linux based systems. Most distributions however ship with a comparable tool, look up the documentation of your distribution. xvditune (in X-terminal). Adjust the settings of the graphical display for all resolutions so as to eliminate black bands, shift the display right/left/up/down, etc. (first use the adjustments on your monitor to fit your text mode correctly on the screen). To make the changes permanent, display the frequencies on the screen and transfer them to the setup file /etc/X11/XF86Config. adduser user_name Create a new account (you must be root). E.g., adduser barbara Don’t forget to set up the password for the new user in the next step. The user home directory is /home/user_name. passwd Change the password on your current account. If you are root, you can change the password for any user using: passwd user_name useradd user_name The same as the command adduser user_name . userdel user_name Remove an account (you must be root). The users home directory and the undelivered mail must be dealt with separately. groupadd group_name Create a new group on your system. Not essential on a home machine with a small number of users. chmod perm filename Change the file access permission for the files you own (unless you are root in which case you can change any file). You can make a file accessible in three modes: read (r), write (w), execute (x) to three classes of users: owner (u), members of the same group as the owner (g), others on the system (o). Check the current access permissions using: ls -l filename If the file is accessible to all users in all modes it will show: rwxrwxrwx The first triplet shows the file permission for the owner of the file, the second for his/her group, the third for others. A no permission is shown as’ –‘ E.g., this command will add the permission to read the file junk to all (user+group+others) chmod a+r junk This command will remove the permission to execute the file junk from others chmod o-x junk You can set the default file permissions for the new files that you create using this command. umask (see man umask). chown new_ownername filename and chgrp new_groupname filename Change the file owner and group. You should use these two commands after you copy a file for use by somebody else. su Assume the superuser (root) identity (you will be prompted for the password). Type exit to return you to your previous login. Don’t habitually work on your machine as root. The root account is for administration and the su command is to ease your access to the administration account when you require it. rpm -ivh filename.rpm Redhat Package Manager, install, verbose, hashes displayed to show progress, as root.) Install the contents of a rpm package and print info on what happened. rpm -qpi filename.rpm Redhat Package Manager, query, package, list.) Read the info on the contents of a un-installed package filename.rpm. rpm -qpl filename.rpm (Redhat Package Manager, query, package,information.) List the files contained in a yet un-installed package filename.rpm. rpm -qf filename (Redhat Package Manager, query, file.) Find out the name of the *.rpm package to which the file filename (on your hard drive) belongs. rpm -e packagename (Redhat Package Manager, erase un-install.) Un-install a package pagckagename. Package name is the same as the beginning of the *.rpm package (without the dash and version number). lsmod List currently loaded kernel modules. modprobe -l |more List all the modules available for your kernel. insmod parport insmod = ppa (as root) Insert modules into the kernel (a module is roughly an equivalent of a DOS device driver). This example shows how to insert the modules for support of the external parallel port zip drive (it appears to be a problem to get the external zip drive to work in any other way under RH6.0 ). rmmod module_name (as root, not essential). Remove the module module_name from the kernel. setserial /dev/cua0 port 0x03f8 irq = 4 (as root) Set a serial port to a non-standard setting. The example here shows the standard setting for the first serial port (cua0 or ttyS0). The standard PC settings for the second serial port (cua1or ttyS1) are: address of i/o port 0x02f8, irq 3. The third serial port (cua2 or ttyS2): 0x03e8, irq 4. The forth serial port (cua3 or ttyS3): 0x02e8, irq 3. Add your setting to /etc/rc.d/rc.local if you want it to be set at the boot time. See man setserial for a good overview. fdisk (as root) Linux hard drive partitioning utility (DOS has a utility with the same name) mkfs -c=20 -t ext2 (floppy disk format, two commands, as root) Perform a low-level format on a floppy in the first floppy drive (/dev/fd0), high density (1440 kB). Then make a Linux filesystem (-t ext2), checking/marking bad blocks (-c ). Making the files system equivalent to the high-level format. fsck -t ext2 /dev/hda2 (file system check, as root) Check and repair a file system. The example uses the partition hda2, file system type ext2. dd if=/boot/vmlinux of=/dev/fd0 dd, stands for Data Duplicator. The above command copies data, i.e the file vmlinuz in RAW format from /boot to the floppy. mount -t iso9660 -r /dev/cdrom /mnt/cdrom This command has to be issued as root unless root has provided you permissions to read from this drive. This command basically mounts the device /dev/cdrom to the directory /mnt/cdrom. Basic Networking tools ping machine_name It stands for Packet Internet Groper. Check if you can contact another machine (give the machine’s name or IP), press Ctrl+C when done. route -n Show the routing table. nslookup host_to_find Query your default domain name server (DNS) for an Internet name host_to_find. ifconfig (as root) Display info on the network interfaces currently active (ethernet, ppp, etc). Your first ethernet device should show up as eth0, the second one as eth1, etc, first ppp over modem as ppp0, second as ppp1, etc. The lo is the loopback only interface which should be always active. Use the options (see ifconfig --help) to configure the interfaces. ifup interface_name (/sbin/ifup to it run as a user) Startup a network interface. E.g.: ifup eth0 ifup ppp0 Users can start up or shutdown the ppp interface only when the rights permission was checked during the ppp setup. ifdown interface_name (/sbin/ifdown to run it as a user). Shut down the network interface. E.g.: ifdown ppp0 Also, see the previous command. netstat | more Displays a lot of (too much perhaps!) information on the status of your network connections. That brings us to the end of this series. Hope you had good time going though it and have been able to further refine your skills at the Linux CLI.
Other articles by Trevor Warren
Current Rating: [ 7.05 / 10 ]
Number of Times Rated: [ 38 ]
|