The Console or Terminal
Windows XP's Command Prompt window or the "DOS Box" of earlier versions of Windows has a parallel under Linux. The actual name of this command-line-entry object depends on the Linux distro you're running, but it's frequently known as the "Console" or "Terminal." In Mandrake, for example, it's called the Console. In Red Hat, it's called the Terminal. You'll find your Console or Terminal somewhere on the main menu of your desktop graphical user interface. When you open it, you'll be presented with a text prompt that will end with: $. That means you're logged in as a normal user.
After typing the "su" command and providing your password, the $ prompt will change to a # prompt, indicating that you're logged in as root (roughly equivalent to an Administrator under Windows, but it carries more weight in Linux):
su
Ctrl-D logs you out as root and brings back the $ prompt. And if you use the Ctrl-D keyboard combination again, the Console will close. A normal prompt looks something like:
[localhost@localdomain:~]$
(Note: The words localhost and localdomain may appear as something different on your Linux PC.)
For nearly every program or command there are "man"-ual pages stored on your computer. Man pages are built-in Linux documentation files. You can read them by typing this in the Console:
man
Here's a specific example. The following command elicits the man pages for the cp command (which handles file copies).
man cp
Use the spacebar to scroll the page, and press the q key to close the man pages.
More information on individual Console commands can often be found by typing " --help" or " --info" after any command, like this:
man --help
cp --info
Navigating the File System and Simple Commands
These are the most often used navigational or directory-related Linux Console/Terminal commands:
|
* Note: Hidden files begin with a period, like this: .Test1
The following are some actual commands you might use and how they would work on your Linux system. These examples assume you've opened a console window on desktop 1 and the home directory in desktop 2, which lets you see and verify the commands you enter in desktop 1.
|
The following are a couple of common Console command combinations followed by an explanation of what they do.
First Combination:
cd /
ls
Changes to the / (root) directory and lists the files and directories there, such as: /boot, /etc, /opt, /root, /tmp, /var, /bin, /dev, /home, /lib, /mnt, and /usr.
Second Combination:
cd /mnt
ls
Shows the mounted and unmounted devices that can be found in the /mnt directory, such as: cdrom, cdrom2, floppy, and (win_c).
To learn more about the above commands and the arguments you can use with them, use the man command followed by the command name, like this:
man cp
man mv
A Few Handy Console Commands
For IP Networking:
su
ifconfig (shows assigned IP addresses)
route (shows traffic)
Display Disk Performance:
hdparm -t /dev/hda
Space Usage:
df -h
du -s /var/log/* (space usage of all the files in /var/log)
Showing Available Memory:
free -b (in bytes)
free -k (in Kilobytes)
free -m (in Megabytes)
free -o (without buffers)
free -t (totals)
Take and Store Screenshot:
import -w root screen.jpg (Stores the file in your /home directory)
See also The One Page Linux Manual in .PDF format.