📄 yolinux tutorial linux system configuration and administration.mht
字号:
/var/log/mailman/qrunner
python 18580 mailman 6u REG 3,5 657 486746 =
/var/log/mailman/qrunner
python 18581 mailman 6u REG 3,5 657 486746 =
/var/log/mailman/qrunner
python 18582 mailman 6u REG 3,5 657 486746 =
/var/log/mailman/qrunner
python 18583 mailman 6u REG 3,5 657 486746 =
/var/log/mailman/qrunner
python 18584 mailman 6u REG 3,5 657 486746 =
/var/log/mailman/qrunner=20
</PRE></DD></DL>The process attached to an open file can be killed=20
using the command <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfuser">f=
user</A>=20
-ki <I>filename</I></TT>=20
<P></P>
<LI>List all open files on system: <TT>lsof</TT> <BR>(Long =
list)=20
<P></P>
<LI>List all files opened by user: <TT>lsof -u =
<I>user-id</I></TT>=20
<P></P>
<LI>The commands <TT>netstat -punta</TT> and <TT>socklist</TT> =
will=20
list open network connections. Use the command <TT>lsof -i=20
TCP:<I>port-number</I></TT> to see the processes attached to =
the port.=20
Example:=20
<DL>
<DD><PRE><B>[root@node DIR]#</B> lsof -i TCP:389
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
slapd 5927 ldap 6u IPv4 7560023 TCP *:ldap (LISTEN)
slapd 5928 ldap 6u IPv4 7560023 TCP *:ldap (LISTEN)
slapd 21185 ldap 6u IPv4 7560023 TCP *:ldap (LISTEN)
slapd 21186 ldap 6u IPv4 7560023 TCP *:ldap (LISTEN)
slapd 21193 ldap 6u IPv4 7560023 TCP *:ldap (LISTEN)
</PRE></DD></DL>This shows that the command <TT>slapd</TT> running=20
under user id <TT>ldap</TT> is running five process connected =
to port=20
389. </LI></UL></DD></DL>
<UL></UL>
<P><B>Restricting user resources:</B>=20
<DL>
<DD>
<UL><A name=3DULIMIT></A>
<LI><B>ulimit:</B> (bash shell command)=20
<P>Shell and process resources may be controlled and reported =
using=20
the <TT>ulimit</TT> command. Display the limits of a shell =
using the=20
bash command "<TT>ulimit -a</TT>". Limits can be set for the =
number of=20
open files and processes, memory and virtual memory etc.=20
<P></P>
<LI>See limits assigned in <TT>/etc/security</TT> (<A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialSysAdmin.html#RESTR=
ICTUSERS">discussed=20
below</A>)=20
<P></P>
<LI>Modify process scheduling priority: Range goes from -20 =
(highest=20
priority) to 19 (lowest).=20
<UL>
<LI>Lower scheduling priority (runs slower and less likely =
to slow=20
you down.) <BR><TT>nice -n 19 <I>program-to-launch</I></TT>=20
<BR>Default for "<TT>nice -n</TT>" is 10=20
<LI>Show default for any process: <TT>nice =
<I>executable</I></TT>=20
<BR>Shows nice value to be used if run. </LI></UL>
<P></P></LI></UL></DD></DL>
<P><A name=3DFILESYSTEMS></A>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Filesystems and Storage=20
Devices:</BIG></B></TD></TR></TBODY></TABLE>
<P><B>Hard Drive Info:</B>=20
<DL>
<DD>
<TABLE>
<TBODY>
<TR>
<TD><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Ddf">df=20
-k</A> </TD>
<TD>report filesystem disk space usage. (-k reports in=20
Kbytes)</TD></TR>
<TR>
<TD><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Ddu">du=20
-sh</A> </TD>
<TD>Calculates file space usage for a given directory. (and=20
everything under it) (-s option summarizes)</TD></TR>
<TR>
<TD><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmount">m=
ount</A>=20
</TD>
<TD>Displays all mounted devices, their mount point, =
filesystem,=20
and access. Used with command line arguments to mount file =
system.</TD></TR>
<TR>
<TD>cat /proc/filesystems </TD>
<TD>Display filesystems currently in use.</TD></TR>
<TR>
<TD>cat /proc/mounts </TD>
<TD>Display mounted filesystems currently in use.</TD></TR>
<TR>
<TD><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dshowmoun=
t">showmount</A>=20
</TD>
<TD>Displays mount info for NFS filesystems.</TD></TR>
<TR>
<TD>cat /proc/swaps</TD>
<TD>Displays swap partition(s) size, type and quantity =
used.</TD></TR>
<TR>
<TD>cat /proc/ide/hda/<I>any-file</I></TD>
<TD>Displays disk information held by=20
kernel.</TD></TR></TBODY></TABLE></DD></DL>
<P><B>Adding an extra hard drive:</B> (<A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialAdditionalHardDrive=
.html">See=20
commands and dialog of adding a second IDE hard drive</A>)=20
<OL>
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfdisk">f=
disk</A>=20
/dev/<I><drive></I></TT> <B>- Allocate drive space and =
register=20
info on the partition table.</B> (Option "n"/"p", then "w" to =
write.)=20
<BR>Also see: <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dsfdisk">=
sfdisk</A>=20
- <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dcfdisk">=
cfdisk</A>=20
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmkfs">mk=
fs</A>=20
-t ext3 /dev/<I><drive></I></TT> <B>- Create file =
system.</B> (RH=20
7.1 and earlier use ext2, RH 7.2-8.0 use ext3)=20
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmount">m=
ount</A>=20
-t ext3 /dev/<I><drive's device name></I> /<I><home2 or =
some=20
suitable directory></I></TT> <B>- Mount the drive</B> =
<BR>Mount a raw=20
ISO file: <TT>mount -t iso9660 -o loop=20
/home/<I>user1</I>/RedHat-9.0-i386-Disk1.iso /mnt/iso-1</TT> =
<BR>(Fstab=20
entry: <TT>/home/<I>user1</I>/RedHat-9.0-i386-Disk1.iso =
/mnt/iso-1=20
iso9660 loop,ro 0 3</TT>) </LI></OL>
<P>Also see: <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmkefs">m=
kefs=20
man page</A>=20
<P>Where the drive is /dev/hdb or some device as conforms to the =
Linux=20
device names:=20
<P>IDE drives are referred to as hda for the first drive, hdb for =
the=20
second etc... IDE uses separate ribbon cables for primary and =
secondary=20
drives. The partitions on each drive are referred numerically. The =
first=20
partition on the first drive is referred to as hda1, the second as =
hda2,=20
the third as hda3 etc ...=20
<P>Linux IDE naming conventions:=20
<DL>
<DD>
<TABLE cellPadding=3D2 border=3D1>
<TBODY>
<TR bgColor=3D#dfdfdf>
<TH>Device</TH>
<TH>Description</TH>
<TH>Configuration</TH></TR>
<TR bgColor=3D#eeeeee>
<TD>/dev/hda</TD>
<TD>1st (Primary) IDE controller</TD>
<TD>Master</TD></TR>
<TR bgColor=3D#eeeeee>
<TD>/dev/hdb</TD>
<TD>1st (Primary) IDE controller</TD>
<TD>Slave</TD></TR>
<TR bgColor=3D#eeeeee>
<TD>/dev/hdc</TD>
<TD>2nd (Secondary) IDE controller</TD>
<TD>Master</TD></TR>
<TR bgColor=3D#eeeeee>
<TD>/dev/hdd</TD>
<TD>2nd (Secondary) IDE controller</TD>
<TD>Slave</TD></TR></TBODY></TABLE></DD></DL>
<P>Note: SCSI disks are labeled /dev/sda, sdb, etc... For more =
info see <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialSCSI.html">SCSI=20
info</A>.=20
<P>Use the command <TT>cat /proc/partitions</TT> to see full list =
of disks=20
and partitions that your system can see.=20
<P>See Linux devices:=20
<UL>
<LI>Kernel 2.4: (Red Hat 7.1+)=20
<UL>
<LI><A=20
=
href=3D"file:///usr/src/linux-2.4/Documentation/devices.txt">file:/usr/sr=
c/linux-2.4/Documentation/devices.txt</A>=20
- (local file) </LI></UL>
<LI>Kernel 2.2: (Red Hat 7.0-)=20
<UL>
<LI><A=20
=
href=3D"file:///usr/src/linux/Documentation/devices.txt">file:/usr/src/li=
nux/Documentation/devices.txt</A>=20
(local file) - H. Peter Anvin </LI></UL></LI></UL>
<P>To make the drive a permanent member of your system and have it =
mount=20
upon system boot, add it to your <TT>/etc/fstab</TT> file which =
holds all=20
the file system information for your system. See <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfstab">m=
an=20
page for fstab</A>.=20
<P>Example of existing /etc/fstab file:=20
<DL>
<DD>
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>/dev/sdb6 / =
ext2 defaults 1 1
/dev/sdb1 /boot ext2 defaults =
1 2
/dev/cdrom /mnt/cdrom iso9660 =
noauto,user,users,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner =
0 0
none /proc proc defaults =
0 0
none /dev/pts devpts =
gid=3D5,mode=3D620 0 0
/dev/sdb5 swap swap defaults =
0 0
</PRE></TD></TR></TBODY></TABLE></DD></DL>
<P>Add SCSI drive by adding line:=20
<DL>
<DD>
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE>/dev/sdc1 /home2 =
ext2 defaults 1 2
</PRE></TD></TR></TBODY></TABLE></DD></DL>
<P>At this point one may optionally check the file system created =
with the=20
command: <TT>fsck /dev/sdc1</TT>=20
<P>Note that <TT>fsck</TT> is NOT run against a mounted file =
system.=20
Unmount it first if necessary. (umount) Also see the man page for: =
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dcfdisk">=
cfdisk</A>=20
- Curses based disk partition table manipulator. (very nice)=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfdisk">f=
disk</A>=20
- Manipulate/configure the partition table.=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dsfdisk">=
sfdisk</A>=20
- Manipulate/configure the partition table.=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dfsck">fs=
ck</A>=20
</LI></UL><A name=3DMOUNTCD></A>
<P>
<HR>
<P><B>Mounting other file systems:</B> (locally attached drives)=20
<P>
<UL>
<LI>Mounting a CD: <TT>mount -r -t iso9660 /dev/cdrom =
/mnt/cdrom</TT>=20
<BR>Un-Mount the CD-ROM: <TT>umount /dev/cdrom</TT> <B>(No "n" =
in=20
<TT>umount</TT>)</B>=20
<P>This command should work for a Red Hat installation. Other=20
distributions may require the following set-up: <PRE> ln =
-sf /dev/hdc /dev/scd0 <B><I>Reference SCSI device directly.</I></B>
<B>OR</B>
ln -sf /dev/hdc /dev/cdrom <B><I>A more typical =
system</I></B>
cd /mnt
mkdir cdrom
mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
</PRE>
<P>Don't forget to un-mount the CD with <TT>umount =
/mnt/cdrom</TT>=20
<BR><B><FONT color=3D#ff0000>[Potential Pitfall]:</FONT></B> =
There is NO=20
"N" in umount!!!=20
<P>For trouble shooting your CD see your kernel documentation:=20
<UL>
<LI>Kernel 2.4: <A=20
=
href=3D"file:///usr/src/linux-2.4/Documentation/ide.txt">file:/usr/src/li=
nux-2.4/Documentation/ide.txt</A>=20
(local file)=20
<LI>Kernel 2.2: <A=20
=
href=3D"file:///usr/src/linux/Documentation/ide.txt">file:/usr/src/linux/=
Documentation/ide.txt</A>=20
(local file) </LI></UL>
<P></P>
<LI><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialRedHatInstallation.=
html#WINPARTITION">Mounting=20
a Windows partition.</A>=20
<P></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -