$ free
total used free shared buffers cached
Mem: 1026320 822112 204208 0 41232 481412
-/+ buffers/cache: 299468 726852
Swap: 2031608 0 2031608
This information constantly changes as the system is used. You can get the same information by using the cat
command to see the contents of the meminfo
file:
$ cat /proc/meminfo
MemTotal: 1026320 kB
MemFree: 204200 kB
Buffers: 41252 kB
Cached: 481412 kB
SwapCached: 0 kB
Active: 307232 kB
Inactive: 418224 kB
HighTotal: 122692 kB
HighFree: 244 kB
LowTotal: 903628 kB
LowFree: 203956 kB
SwapTotal: 2031608 kB
SwapFree: 2031608 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 202804 kB
Mapped: 87864 kB
Slab: 21736 kB
SReclaimable: 12484 kB
SUnreclaim: 9252 kB
PageTables: 5060 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 2544768 kB
Committed_AS: 712024 kB
VmallocTotal: 114680 kB
VmallocUsed: 6016 kB
VmallocChunk: 108148 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
The /proc
directory can also be used to dynamically alter the behavior of a running Linux kernel by "echoing" numeric values to specific files under the /proc/sys
directory. For example, to "turn on" kernel protection against one type of denial-of-service (DoS) attack known as SYN flooding, use the echo
command to send the number 1
(one) to the following /proc
path:
# echo 1 >/proc/sys/net/ipv4/tcp_syncookies
NOTE
The Linux kernel has a number of built-in protections, but good system administration security policies and a secure firewall protecting your gateway, router, or Internet-connected system are the best protection you can use. See Chapter 30, "Securing Your Machines," for an overview of firewalling and examples of how to implement network security tools included with Fedora.
Other ways to use the /proc
directory include
► Getting CPU information, such as the family, type, and speed from / proc/cpuinfo
.
► Viewing important networking information under /proc/net
, such as active interfaces information under /proc/net/dev
, routing information in /proc/net/route,
and network statistics in /proc/net/netstat
.
► Retrieving file system information.
► Reporting media mount point information via USB; for example, the Linux kernel reports what device to use to access files (such as /dev/sda
) if a USB camera or hard drive is detected on the system. You can use the dmesg
command to see this information.
► Getting the kernel version in /proc/version
, performance information such as uptime in /proc/uptime,
or other statistics such as CPU load, swap file usage, and processes in /proc/stat
.
Work with Shared Data in the /usr
Directory
The /usr
directory (nearly 3GB in size if you do a default install) contains software applications, libraries, and other types of shared data for use by anyone on the system. Many Linux system administrators give /usr
its own partition. A number of subdirectories under /usr
contain the X Window System ( /usr/bin
), manual pages ( /usr/share/man
), software package shared files ( /usr/share/ name_of_package
, such as /usr/share/emacs
), additional application or software package documentation ( /usr/share/doc
), and an entire subdirectory tree of locally built and installed software, /usr/local
.
Temporary File Storage in the /tmp
Directory
As its name implies, the /tmp
directory is used for temporary file storage; as you use Linux, various programs create files in this directory. The /tmp
directory is cleaned of stale files each day by the tmpwatch
command. (A stale file is any file not used after 10 days.) Settings in your system's scheduling table, /etc/crontab
, configure Fedora by default to use tmpwatch
to check /tmp
each day.
Access Variable Data Files in the /var
Directory
The /var directory contains subdirectories used by various system services for spooling and logging. Many of these variable data files, such as print spooler queues, are temporary, whereas others, such as system and kernel logs, are renamed and rotated in use. Incoming electronic mail is usually directed to files under /var/spool/mail.
Linux also uses /var
for other important system services. These include the topmost File Transfer Protocol (FTP) directory under /var/ftp
(see Chapter 20, "Remote File Serving with FTP"), and the Apache web server's initial home page directory for the system, /var/www/html
. (See Chapter 17, "Apache Web Server Management," for more information on using Apache.)
Logging In to and Working with Linux
You can access and use a Linux system in a number of ways. One way is at the console with a monitor, keyboard, and mouse attached to the PC. Another way is via a serial console, either by dialup via a modem or a PC running a terminal emulator and connected to the Linux PC via a null modem cable. You can also connect to your system through a wired or wireless network, using the telnet
or ssh
commands. The information in this section shows you how to access and use the Linux system, using physical and remote text-based logins.
NOTE
This chapter focuses on text-based logins and use of Linux. Graphical logins and using a graphical desktop are described in Chapter 3.
If you sit down at your PC and log in to a Linux system that has not been booted to a graphical login, you see a prompt similar to this one:
Fedora release 8 (Werewolf)
Kernel 2.6.23-1.217 fc8 on an i686
login:
Your prompt might vary, depending on the version of Fedora you are using. In any event, at this prompt, type in your username and press Enter. When you are prompted for your password, type it in and press Enter.
NOTE
Note that your password is not echoed back to you, which is a good idea. Why is it a good idea? Well, people are prevented from looking over your shoulder and seeing how many characters are on your screen. It is not difficult to guess that a five-letter pass word might correspond to the user's spouse's first name!
Use the exit
or logout
commands to exit your session. Type the command and press Enter. You are then returned to the login prompt. If you use virtual consoles, remember to exit each console before leaving your PC. (Otherwise, someone could easily sit down and use your account.)
Logging In and Out from a Remote Computer
Although you can happily log in on your computer, an act known as a local login, you can also log in to your computer via a network connection from a remote computer. Linux-based operating systems provide a number of remote access commands you can use to log in to other computers on your local area network (LAN), wide area network (WAN) , or the Internet. Note that not only must you have an account on the remote computer, but the remote computer must be configured to support remote logins—otherwise, you won't be able to log in.
Читать дальше