Article title: a wonderful Q & A in Linux-network-independent articles. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
0001 modify the host name (bjchenxu)
Vi/etc/sysconfig/network, change the HOSTNAME line to "HOSTNAME = host name" (no such line? Add this line), and then run the command "hostname host name ". Whether you restart or not, the host name is successfully modified.
0002 Ret Hat Linux boot to the text interface (do not start xwindow) (bjchenxu)
Vi/etc/inittab
Id: x: initdefault:
X = 3: text mode x = 5: graphic mode
0003 linux automatic upgrade and update (huhuuworm, NetDC)
For redhat.
Upgrade rpm except kernel: up2date-u
Upgrade rpm including kernel: up2date-u-f
Because the Red Hat Network SSL certificate expires, you should execute a script before rhn_register | up2date to update the certificate:
Wget-q-O-https://rhn.redhat.com/help/new-cert.sh |/bin/bash
There is still a big difference between Debian and other releases. it is more convenient to use Debian for server maintenance. Red Hat upgrade is actually quite troublesome. of course, if you pay Red Hat for it, services are different.
Upgrade Software in Debian:
Apt-get update
Apt-get upgrade
Prerequisites: configure the network and/etc/apt/sources. list, or use apt-setup.
0004 linux partition software (bjchenxu) in windows)
Paragon.ext2fs.anywhere.2.5.rarand 410e2fs-1.00-pre4.zip
0005 mount usage (sakulagi, sxsfxx)
Fat32 partition mount-o codepage = 936, iocharset = cp936/dev/hda7/mnt/cdrom
Ntfs partition mount-o iocharset = cp936/dev/hda7/mnt/cdrom
Iso file mount-o loop/abc. iso/mnt/cdrom
Floppy disk mount/dev/fd0/mnt/floppy
USB flash mount/dev/sda1/mnt/cdrom
Mount-a for all/etc/fstab content
You can specify the file format "-t format", which can be vfat, ext2, and ext3.
Access the DVD mount-t iso9660/dev/dvd/mnt/cdrom or mount-t udf/dev/dvd/mnt/cdrom
Note: the dvd format is usually iso9660 or one of the Udfs.
0006 using local hard disk FAT partition (bjchenxu) in vmware LINUX)
Share the local FAT partition, and then use SMBFS on VMWARE. You can put the following rows in/etc/fstab:
// Win_ip/D $/mnt/d smbfs defaults, auto, username = win_name, password = win_pass, codepage = 936, iocharest = gb2312 0 0
Here, win_ip is your windows IP address;
D $ is the name of the shared D disk in your windows system;
/Mnt/d: mount the partition to the linux directory;
Win_name and win_pass are users who can read the partition in WINDOWS, such as your administrator name and password.
If you run/etc/rc. d/init. d/netfs, the partition will be automatically mounted at startup.
0007. a delete a file named-a (bjchenxu)
Rm./-
Rm ---a tells rm that this is the last option. for details, see getopt.
Ls-I to list inum, and then use find.-inum inum_of_thisfile-exec rm {}\;
0007. B delete a file named \ a (bjchenxu)
Rm \
0007. c delete the/and '\ 0 files with names (bjchenxu)
These characters are not allowed by the normal file system, but may be generated in the file name. for example, the NFS file system in unix is used on the Mac system.
1. Solution: Mount the NFS file system to a system that does not filter/character to delete files with special file names.
2. you can also remove other files in the directory with the wrong file name. The ls-id displays the inum and umount file systems containing the file directory,
Clri clears the inum, fsck, mount, check your lost + found, rename the file in it.
It is best to delete any file name through windows ftp!
0007. d delete a file named with invisible characters (bjchenxu)
List file names and dump them to files: ls-l> aaa
Then edit the file content and add the rm command to make its content the format for deleting the above file:
Vi aaa
[Rm-r *******
]
Add the execution permission chmod + x aaa to the file
Run $ aaa
0007. e delete a file with zero size (bjchenxu)
Rm-I 'find./-size 0'
Find./-size 0-exec rm {}\;
Or
Find./-size 0 | xargs rm-f &
Or
For file in * # define the file type to be deleted
Do
If [! -S $ {file}]
Then
Rm $ {file}
Echo "rm $ file Success! "
Fi
Done
0008 redhat setting scroll wheel mouse (mc1011)
After entering X, select the mouse configuration, and select the wheel mouse (ps/2,
If the mouse performance is abnormal, restart the computer.
(Or su, vi/etc/X11/XF86Config, change PS/2 to ImPS/2)
0009 install xwindow (bjchenxu)
Start with a linux CD, select upgrade, and then select a separate package to install
0010 delete linux partition (bjchenxu)
Make a boot floppy disk for partition magic, delete it after startup, or start it with a win2000 boot disc, and then delete it.
0011 how to exit man (bjchenxu)
Q
0012 do not compile the kernel, mount ntfs partition (bjchenxu, huhuuworm)
Original rh8, kernel not upgraded or compiled
1. search and download kernel-ntfs-2.4.18-14.i686.rpm on google.com
2. rpm-ivh kernel-ntfs-2.4.18-14.i686.rpm
3. mkdir/mnt/c
4. mount-t ntfs/dev/hda1/mnt/c
Or
Read only: http://linux-ntfs.sourceforge.net/
Read/Write: http://www.jankratochvil.net/project/captive/
0013 tar volume splitting compression and merge (WongMokin)
Take MB per volume as an example
Tar volume compression: tar cvzpf-mytarfile.tar.gz | split-d-B 500 m
Tar multi-volume merge: cat x *> mytarfile.tar.gz
0014 retrieve the missing root password (bjchenxu) when using lilo/grub)
Three methods:
1. when the system enters the single-user status, directly use passwd root to change
2. install the CD boot system and run the linux rescue status to connect the original/partition as follows:
Cd/mnt
Mkdir hd
Mount-t auto/dev/hdaX (original/partition ID) hd
Cd hd
Chroot ./
Passwd root
This can be done.
3. take the local hard disk and mount it to other linux systems. the method is the same as the second one.
Rh8 medium
I. lilo
1. When lilo appears: enter linux single
Lilo: linux single
2. press enter to directly access the linux command line
3. # vi/etc/shadow
Delete the contents of the first line, that is, the content before "root" and "next", in the line starting with "root,
The first line is similar
Root ::......
Save
4. # restart reboot. the root password is blank.
II. grub
1. when the grub screen appears, use the up and down keys to select the one you usually start linux (do not select dos), and then press the e key
2. use the up and down keys again to select the one you usually start linux (similar to kernel/boot/vmlinuz-2.4.18-14 ro root = LABEL =/), and then press the e key
3. modify the command line you see and add single. The result is as follows:
Kernel/boot/vmlinuz-2.4.18-14 single ro root = LABEL =/
4. press enter to return, and then press the B key to start, you can directly enter the linux command line
5. # vi/etc/shadow
Delete the contents of the first line, that is, the content before "root" and "next", in the line starting with "root,
The first line is similar
Root ::......
Save
6. # restart reboot. the root password is blank.
0015 invalidate ctrl + alt + del (bjchenxu)
Vi/etc/inittab
Comment out the ca: ctrlaltdel:/sbin/shutdown-t3-r now line.
0016 how can we see whether the redhat version is 7 or 8 (huhuuworm)
Cat/proc/version or cat/etc/redhat-release or cat/etc/issue
0017 file in which rpm (no dual)
Search on www.rpmfind.net or get the rpm-qf file name
0018 save man or info information as a text file (bjchenxu)
Take tcsh as an example:
Man tcsh | col-B> tcsh.txt
Info tcsh-o tcsh.txt-s
0019 generate a new file (bjchenxu) using two existing files)
1. extract the union of the two files (duplicate rows only retain one copy)
2. extract the intersection of two files (only files that exist in both files are left)
3. delete the intersection and leave other rows.
1. cat file1 file2 | sort | uniq
2. cat file1 file2 | sort | uniq-d
3. cat file1 file2 | sort | uniq-u
0020 set the com1 port so that the super terminal can log on through the com1 port (bjchenxu)
Confirm/sbin/agetty, edit/etc/inittab, and add
7: 2345: respawn:/sbin/agetty/dev/ttyS0 9600
9600bps is because the default rate is generally the same as that of a vro.
19200, 38400, 57600, 115200
Modify/etc/securetty and add a line: ttyS0 to ensure that the root user can log on.
Restart the machine, and you can unplug the mouse and keyboard display (it is best to check the output information at startup ).
0021 delete all files in the directory including subdirectories (bjchenxu)
Rm-rf directory name
0022 View system information (bjchenxu)
Cat/proc/cpuinfo-CPU (I. e. vendor, Mhz, flags like mmx)
Cat/proc/interrupts-interrupt
Cat/proc/ioports-device IO port
Cat/proc/meminfo-memory information (I. e. mem used, free, swap size)
Cat/pr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.