Linux classic problems-Basics

Source: Internet
Author: User
Article Title: linux classic question-basics. 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 host name
In vi/etc/sysconfig/network, change the HOSTNAME line to HOSTNAME = Host Name, which will take effect after restart.
  
0002
Ret Hat Linux is started to the text interface (xwindow is not started)
Change id: 5: initdefault in/etc/inittab to 3
  
0003
Automatic upgrade and update of redhat (huhuuworm)
In.
Upgrade rpm except kernel: up2date-u
Upgrade rpm including kernel: up2date-u-f
  
0004
Linux partition software in windows
Paragon.ext2fs.anywhere.2.5.rarand 410e2fs-1.00-pre4.zip
  
0005
Mount usage
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.
  
0006
Use the FAT partition of the local hard disk 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.
Delete an object named-
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 an object named \
Rm \
  
0007. c
Delete the/and '\ 0 files with names
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 an object with invisible characters
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 an object of zero size
Rm-I 'Find./-size 0'
Find./-size 0-exec rm {}\;
Find./-size | xargs rm-f & very effective
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
After entering X, select the mouse configuration, and select the wheel mouse (ps/2,
If the mouse performance is abnormal, restart the computer.
  
0009
Install xwindow
Start with a linux CD, select upgrade, and then select a separate package to install
  
0010
Delete linux partitions
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
Q
  
0012
Do not compile the kernel, mount ntfs partition
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
  
0013
Use xmms in redhat 8.0 to listen to mp3
Download www.gurulabs.com/files/xmms-mp3-1.2.7-13.p.i386.rpm
Rpm-Uvh xmms-mp3-1.2.7-13.p.i386.rpm
  
0014
Retrieve the forgotten root password (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
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
In which rpm the file is located
Search on www.rpmfind.net or get the rpm-qf file name
  
0018
Save man or info information as a text file
Take tcsh as an example:
Man tcsh | col-B> tcsh.txt
Info tcsh-o tcsh.txt-s
  
0019
Generate a new file 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 to allow the Super Terminal to log on through the com1 port.
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
Rm-rf directory name
  
0022
View System Information
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/proc/partitions-all partitions of all devices
Cat/proc/pci-PCI device information
Cat/proc/swaps-information about all Swap partitions
Cat/proc/version-Linux version is equivalent to uname-r
Uname-a-view system kernel and other information
  
  
0023
Remove unnecessary carriage returns
Sed s/^ M // test. sh> back. sh. Note that ^ M is obtained by pressing ctrl_v ctrl-m.
Or dos2unix filename
  
0024
Switch X Desktop
Switchdesk KDE or switchdesk GNOME
  
0025
General Sound Card Driver
OSS www.opensound.com/ALSA www.alsa-project.org/
  
0026
Change the redhat System Language/Character Set
Modify the/etc/sysconfig/i18n file, as shown in figure
LANG = "en_US", xwindow will display the English interface,
LANG = "zh_CN.GB18030", xwindow displays the Chinese interface.
Another method
Cp/etc/sysconfig/i18n $ HOME/. i18n
Modify the $ HOME/. i18n file, as shown in figure
LANG = "en_US", xwindow will display the English interface,
LANG = "zh_CN.GB18030", xwindow displays the Chinese interface.
In this way, the user interface language can be changed without affecting other users <

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.