The basic commands of Linux. By John Isam This document will provide some of the basic commands of linux. I suggest you print this if you are a first time linux user, or are about to install linux for the first time. It is always good to have a reference, so that when you see your first prompt, you have an idea of how to move around. --------------------------------------------------------------------- To give commands to linux, you must type them after the linux shell prompt. On RedHat machines, the prompt is usually the character '%', or '#' for root (ignore the '' marks). Usually the '%' prompt is preceded by a string of characters that represent the part of the linux file system that is the current directory. The current directroy is displayed automatically for you as a way to help you remember where in the file systems you are. In general linux pays attention to the case of what you type. The commands 'ls' and 'LS' are not the same. If you think you are typing good commands, but linux doesn't like them, check that you haven't set Caps Lock on your keyboard. The following are some of the basic commands, that linux uses. There are many other commands available that I won't cover. man (command) Displays the section of the linux manual concerning (command). For example, 'man ls' displays information about the 'ls' command. 'man man' shows information about the 'man' command. This is linux's version of online help. This is also a good way to learn about all the tags that certain commands have. For example 'ls -a' provides a different output, then just 'ls' would. ls Lists the files in the current directory. ls (pathname) Lists files in the directory described by (pathname) completion This isn't really a command, but you will soon find it to be very useful. Linux supports long, VERY LONG file names. To save time typing, just type the first letter or two of a directory, or file, then hit the button. Linux will complete the typing for you. If there are other files too similar to what you've typed so far, you might have to type a few more letters, before will finish the file/directory for you. *note* that this is only a function of Red Hat linux, and that it might not work for other Un*xs. mv (pathname1) (pathname2) Moves the file found at (pathname1) to the position specified by (pathname2). After you move a file, it no longer exists at (pathname1) cp (pathname1) (pathname2) Copies the file at (pathname1) to (pathname2). Works like the 'mv' command, except the file found (pathname1) is not destroyed when written to (pathname2). If there was a file at (pathname2) it is destroyed/overwritten. rm (pathname1) Removes (destroys/deletes) the file at (pathname1) mkdir (pathname1) Makes a directory with the name specified by (pathname1). cd (pathname1) Changes the current directory to be that specified by (pathname1) pwd Displays what the current directory is. Stands for print working directory. rmdir (pathname1) Removes the directory specified by (pathname1) cat (pathname1) Allows you to view the contents of a file. This works best for files that contain simple characters, instead of executable programs. cat (pathname1) (pathname2) Adds the file at (pathname2) to the end of the file at (pathname1). This is called concatenation. The result is a single file with the name (pathname1), having the contents of both. telnet (address) Allows you to connect to the computer at (address). However the computer must be willing to accept users, and you must have an account on that computer. rlogin (address) Similar to telnet. Stands for remote login. ftp (address) Allows you to connect to the computer at (address). Much like telnet, only the purpose of ftp is to send/receive files from/to (address). Stands for file transfer protocal. ncftp (address) Similar to ftp, only slightly more graphical, easier to use. talk (user) Used to chat with another user on the same machine. w Used to see all present users, and what they are doing. su (user) Used to switch user. Often used to telnet into a machine, and switch to root. Stands for substitute user identity. mount Used to mount file systems. Usually restricted to root only. Enables linux to read from floppy drives, cdrom, and non linux partitions. Can be complicated, but here is an example of a mount command, to mount your cdrom. eg - 'mount /dev/cdrom /mnt/cdrom' Then to read your cdrom, you would look in the directory '/mnt/cdrom'. umount Used to unmount, mounted file systems. This is usually required with floppies, in order to ensure all files are saved/updated. An example of unmounting the mount done in the previous example is: 'umount /mnt/cdrom'. This will also enable you to open your cdrom, as it can't be opened, when mounted. logout Used to logout of login shells. exit Used to exit non-login shells. shutdown (tag) (time) Used to shutdown the system at a given time. Usually only root has this command. Can be used to reboot the system, to shutdown and halt the system, and also allows you to provide a warning message to any users on the system. eg use: 'shutdown -r now' will reboot the system, immediately. reboot Very similar to shutdown. pine Starts the e-mail mailer pine. This is one of the mailers that is available. It seems to be the standard for U of G. ctrl-c Often used to kill off operations. An example is to end a talk session. mcopy Part of the mtools utility provided with linux. Used to move/copy msdos files to/from linux. Often used in the labs, to copy files to/from disks. pico Basic editor, similar to edit in dos. vi Complex, and powerful text editor. vim Similar to vi. Stands for Vi IMproved. It is considered a programmers text editor. SOME X COMMANDS TO LOOK AT: I will not spend much time on these, as X can be complicated, but these commands will get you started. startx, xinit, xdm, Xconfigurator, XF86Setup, Xvidtune, X, SOME FILES TO LOOK AT: Here are a brief list of files you should look at. I don't suggest changing or altering them, until you know what they do. Many of them are only created for certain shells, so don't be worried, if you don't have some of them. I will use '~' to represent your home directory. ~/.xinitrc, /etc/fstab, /etc/inetd.conf, /etc/passwd, ~/.tcshrc, ~/cshrc, John Isam Last Modified Wed Feb 10 20:49:32 EST 1999