13.2 UNIX Commands
The family of available UNIX commands is almost endless, and each command is usually endowed with a dazzling array of arguments and variants allowing you to do virtually anything you can imagine. There are a few basic command, though, that youll use constantly. These are introduced here.
The cd command simply moves you to another directory. cd with no arguments returns you to your home directory. To go up a level, use cd followed by two periods.
Viewing Files: cat , more and less
To look at a file without invoking a text editor, just use the command cat. The name has nothing to do with furry felines; it derives from the word catenate (or concatenate), meaning to attach or append the file you want to see to the ongoing data stream. Thus, when you invoke cat with a filename, the file will simply scroll by as quickly as your system allows, usually much too fast to read. This is fine for tiny files that wont scroll off the screen.
For longer files, use the command more instead cat. This displays a screenful at a time, allowing you to press the space bar to see the next screenful. more is endowed with lots of powerful options. For example, to search for a string in a file, press the slash key, type the string youre looking for and press ,<return>.
Just to make life more interesting, theres a more powerful variant of more called (what else?) less. less, in true UNIX style, does much more than more, proving once and for all that less is more.
Moving and Copying Files: mv and cp
the mv command lets you move one or more files. mv differs from cp (copy) in that the file(s) are deleted from their original location. When using cp, the file(s) remain at their original location, and are copied to the new location as well.
Building Files and Other Objects: make
make, an operation that uses special files called Makefiles, is the basic UNIX command for building object files and libraries from source code files, and for building executable program files from object files. But make is also a general purpose program that allows you to do such things as create PostScript documents and other useful items. make lets you build up a file in small, manageable, incremental steps.
Creating and Deleting Directories: mkdir and rmdir
mkdir lets you create a directory. rmdir deletes a directory.
Creating Files and Editing Text: jed and emacs
These are two popular and powerful UNIX text editors. Among many other things, a text editor is the tool you use to create a file in the first place. emacs has been likened to the ancient Japanese game go, as it takes only moments to learn but a lifetime to master. jed is a simpler, easier to comprehend emacs clone. In your particular UNIX system, the delete function within jed may be accomplished either by the backspace key or <CTRL-D>. However, in some environments, the backspace key might be the same as <CTRL-H>. This is mentioned here because locating the backspace function is a common source of frustration for new users of a text editing program.
grep is the classic UNIX all-purpose string search command. Depending on your UNIX implementation, grep may work quite differently, or be endowed with a different range of abilities and arguments. Be sure to read the man page for grep.
gcc is a popular compiler for the C programming language, UNIXs native tongue, and the language used by far more than any other in program development in the UNIX environment. gcc is the GNU C Compiler, and is thus subject to the GNU license.