Linux one-sentence Q & A 5 from the Linux times Network)

Source: Internet
Author: User
Tags apm i18n dmesg
1111 grep does not display its own process (Chen Xu)
# Ps-Aux | grep httpd | grep-V grep
Grep-V grep can cancel displaying the grep process you are executing. The-V parameter does not display the name of the listed process.

1112 delete a file (wongmokin) containing a keyword in the directory)
Find/mnt/ebook/-type F-exec grep "Enter the keyword" {}/;-print-exec RM {}/;

1113 make the task in cron do not give back information. In this example, check the email (wongmokin) once every 5 minutes)
0-59/5 */usr/local/bin/fetchmail>/dev/null 2> & 1

1114 decompress the RPM file in the current directory (Chen Xu)
Cat kernel-ntfs-2.4.20-8.i686.rpm | rpm2cpio | Pax-R

1115 merge two postscript or PDF files (noclouds)
$ GS-Q-dnopause-dbatch-sdevice = pswrite/
-Soutputfile = bar. PS-F foo1.ps foo2.ps
$ GS-Q-dnopause-dbatch-sdevice = writable write/
-Soutputfile?bar=- F foo1.pdf foo2.pdf

1116 remove the suffix of all. En in the manual directory of Apache (Chen Xu)
Go to the manual directory
Code: Find. /-RegEx. */. en | awk-f. '{printf "Mv % S. % S. % S. % S. % S. % s/n ", $1, $2, $3, $4, $1, $2, $3} '| sh

1117 how to create multiple X (noclouds)
Startx is the first X starting from display: 0.0 by default. Multiple X can be created by passing parameters to xserver:
# Startx --: 1.0
# Startx --: 2.0
...
Then switch with Ctrl-Alt-F7/f8.

1118 let a program continue running after logging out (noclouds, Chen Xu)
# <Cmd>
# Disown
Or
Nohup command &

1119 check the screen display information when Linux is started (Chen Xu)
Run the dmesg command to view

1120 keep VI alert (sakulagi)
Echo "set VB t_vb =" >> ~ /. Vimrc

1121 Enable Automatic Login (dzho002) after ora is started)
1) rpm-ihv autologin-1.0.0-7mdk. I 586 rpm
2) create a file/etc/sysconfig/autologin
Add a line to it.
User = root

1122 how to configure which services to start (q1208c)
Method 1 run the ntsysv or setup command to enter the menu for configuration
Method 2 chkconfig -- list display Service
Chkconfig name on/off enable/disable the "name" Service

1123 safely delete Linux (days outside the idle cloud)
Step 1 use fdisk/MBR in DOS or use a Win2000/XP disc to start the fault recovery console and run the fixmbr command
Step 2. format the LINUX partition as a Windows partition.

1124 use grub to guide the text interface (off-the-cloud)
After entering grub, press a and enter space 3 to guide the text interface, but the system running level is not modified and only valid for this time.

1125 first, test whether the patch runs normally. do not apply the changes to the kernel (jiadingjun)
Patch -- dry-run

1126 use netdc to install and delete files on Redhat and Debian)
Delete a software package:
Rpm-E <package-Name>
Dpkg-r <package-Name>
Display the content of a software package:
Rpm-qvl <package-name.rpm>
Dpkg-C <package-name.deb>
Show all installed software packages:
Rpm-qvia
Dpkg-l
Print the information of a package:
Rpm-QPI <package-name.rpm>
Dpkg-I <package-name.deb>
Test package characteristics:
Rpm-va
Debsums-
Check which package a file belongs:
Rpm-QF </path/to/File>
Dpkg-S </path/to/File>
Install the new software package:
Rpm-uvh <package-name.rpm>
Dpkg-I <package-name.deb>

1127 how to force a new user to change the password after logging on to the system for the first time)
# Useradd-P ''testuser; chage-D 0 testuser

1128 log maintenance tool logrotate (hotbox)
Configure in/etc/logrotate. conf to automatically compress the log file when the log file reaches the predefined size or time.

1129 what is the default Administrator name in Linux (Chen Xu)
Root

1130 how to generate an empty file with a fixed length (for example, the file length is 1 MB), that is, each byte value is 0x00 (sakulagi)
Dd If =/dev/Zero of =/tmp/zero_file BS = 1024 COUNT = 1024

1131 steps for modifying the time in RedHat Linux (huhuuworm)
1. Set your time zone: Select Asia/Shanghai in timeconfig (if you are in GMT + 8 China Region)
2. Calibration with standard time server: ntpdate time.nist.gov
2.5 of course, if you are Li Ka Shing, you can also calibrate with your own watch: Date-s string (for string format, see man date)
3. Write back the hardware clock: hwclock -- systohc

1132 search for files in the current directory and change the extension (summer of year 02)
Change all. SS files to. AA
# Find./-name "*. SS"-exec rename. Ss. AA '{}'/;

1133 patch usage (genius ※sakura wood)
The syntax is Patch [Options] [originalfile] [patchfile].
For example:
Patch-P [num] <patchfile
The-p parameter determines whether to use the prefix directory information of the read source file name. If the-p parameter is not provided, all directory information is ignored.-P0 (or-P 0) indicates that all the path information is used.-P1 ignores the previous directory "/" and so on. A file name such as/usr/src/linux-2.4.16/makefile uses the linux-2.4.16/makefile as the file to be patched when the-P3 parameter is provided.
For the Linux kernel source code 2.4.16, assume that the source code directory is in/usr/src/Linux, you can use "patch-P0 <patch-2.4.16" when the current directory is/usr/src. When the current directory is/usr/src/Linux, "patch-P1 <patch-2.4.16" can also work properly.

1134 change 123 in file.txt to 456 (huhuuworm)
Method 1
Sed's/123/456/G' file.txt> file.txt. New
MV-F file.txt. New file.txt
Method 2
VI file.txt
Enter the following command:
: % S/123/456/g

1135 format a partition as an ext3 Log File System (huhuuworm)
Mkfs-J/dev/xxxx

1136 enable hard disk ata66 (laixi781211)
/Sbin/hdparm-D1-x68-C3-M16/dev/hda

1137 view the current running level (dual eyelid pig)
Runlevel

1138 view current login identity (dual eyelid pig)
(1) Who am I
(2) whoami
(3) ID
Note the small differences between (1) and (2 ).

1139 Delete packages that cannot be deleted by rpm-E (wwwzc)
1. If the directory of the package is deleted before the package is deleted
Rpm-e -- noscripts
2. If a package in the system is installed twice (due to some exceptions)
Rpm-E multi-installed-pkgs -- allmatches

1140 how to customize the information displayed during user login (jiadingjun)
Put a text file named motd under the/etc directory, for example, create your own/etc/motd:
$ CAT/etc/motd
Welcome to my server!
When a user logs on to the system, the following information appears:
Last login: Thu Mar 23 15:45:43 from *.*.*.*
Welcome to my server!

1141 run the command to clear the files in the root Recycle Bin (dtedu)
CD/var/. Trash-Root
Rm-RF *

1142 add simsun. TTC to Red Hat (Chen Xu)
Take Red Hat 7.3 as an example. Select Simplified Chinese for installation and copy a simsun. TTC to/usr/x11r6/lib/X11/font/TrueType, renamed simsun. TTF; then go to the/usr/x11r6/lib/X11/font/TrueType directory and run ttmkfdir> fonts. dir command, and then use VI to edit fonts. dir file, put the simsun. modify the TTF line as follows:
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-c-0-ascii-0
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-c-0-iso10646-1
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-p-0-iso8859-15
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-p-0-iso8859-1
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-c-0-gb2312.1980-0
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-p-0-gb2312.1980-0
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-m-0-gb2312.1980-0
Simsun. TTF-MISC-simsun-Medium-r-normal -- 0-0-0-0-p-0-gbk-0
Run the cat fonts. dir> fonts. Scale command, modify/etc/X11/XF86config-4, and add the following line in section "Files:
Fontpath "/usr/x11r6/lib/X11/fonts/TrueType"
Go back to the KDE Desktop and change all fonts to simsun in "start"> "option"> "View"> "font.

1143 differences between unicon and zhcon and their functions (Chen Xu)
Unicon is a kernel-state Chinese platform based on the modification of Linux framebuffer and virtual console (fbcon. Because it is implemented at the underlying level of the system, it has excellent compatibility and supports GPM mouse directly. But it is relatively dangerous. A slight vulnerability may compromise system security. Zhcon is a Chinese platform in user mode, a bit like UCDOS.

1144 how to uninstall the software installed in tar format (Chen Xu)
Go to the original code directory where the software is installed and run make Uninstall. If not, you can also check the MAKEFILE file, which mainly depends on the install part. Find out the path to which the tar-format file is copied, and then enter the corresponding directory to delete it.

1145 customized Linux prompt (Chen Xu)
In bash, the prompt is specified through an environment variable $ ps1. Use export $ PS1 to view the current value. For more intuitive and common prompts, set export PS1 = "[/u @/h/W]/$ ". /U indicates the user name,/h indicates the host name,/W indicates the last layer of the current working directory, and $ indicates the common user/$, and # indicates the root user #.

1146 search for a word in VI, which is highlighted and looks uncomfortable. How can I remove it (Chen Xu)
In the command mode of VI, enter nohlsearch. You can also ~ /. The above statements written in vimrc will be highlighted:
Set hlsearch
The following statement is not highlighted:
Set nohlsearch

1147 how to find all *. cpp and *. H files in the system (Chen Xu)
Use the find command. However, if the search from the root directory consumes a lot of resources, you can use the following command:
Find/-name "*. cpp"-o-name "*. H"

1148 how many disks is required for Debian installation? Are all seven disks downloaded? (Chen Xu)
If you often have a network environment, download the first one. Debian is not recommended if there is no network environment, because Debian mainly relies on the network to update software. If you really want to install it, you need to download all 7 disks. Otherwise, the required software package may not be found.

Why are there two versions of the first Debian disc in 1149? Which one should I download from debian-30r1-i386-binary-1.iso and debian-30r1-i386-binary-1_NONUS.iso? What are their differences? (Chen Xu)
Because Software containing "non-us" (not in the United States) cannot be legally stored on servers deployed in the United States. In the past, it was often because the software had a strict cryptographic code. Today, it was because the program used an algorithm protected by the U.S. Patent. Everyone should use "non-us" for private purposes, while ISO without this logo is only useful for us images and vendors. Other binary discs do not contain any "US-sensitive" (related to the US) software, which works as well as other binary-1 discs. Therefore, for personal use, download the debian-30r1-i386-binary-1_NONUS.iso version.

1150 why is there a statement like device is busy when I use the umount/mnt/CDROM command, not umount (Chen Xu)
When using umount, make sure that you have exited the/mnt/CDROM directory. If you exit this directory, you can use umount/mnt/CDROM.

1151 I use a laptop. How can I display the remaining power in the console? (Chen Xu)
You can use APM-m to view the remaining minutes. You can use man APM to view the specific parameters.

1152 why is a man command garbled when I enter the Linux terminal window? (Chen Xu)
This is because your character set settings are incorrect. For temporary solutions, use export lang = "en_us ". You can modify lang = "en_us" in the/etc/sysconfig/i18n file if you do not need to modify it every time. You can also change the UI Language of a user without affecting other users. Command: # cp/etc/sysconfig/i18n $ home/. i18n.

1153 when an error occurs during kernel compilation, the system prompts "Too program open files". How can this problem be solved? (Chen Xu)
This is because the default value of file-max (8096) is too small. To solve this problem, run the following commands as root (or add them to the init script under/etc/rc. d ):
# Echo "65536">/proc/sys/
Finally, enter the decompressed directory and run the installation command.
# Cd vmware-Linux-Tools
#./Install. pl

1154 was originally installed with Linux and Windows XP. After a Windows XP Reinstallation, I found that I could not find the Linux and Windows XP startup menus. How can I solve this problem? (Chen Xu)
First, start the CD, enter rescue mode, run grub, enter grub prompt grub>, and then press the following statement to restart.
Root (hd0, 2), setup (hd0)

1155 if you have installed a Linux server and want to compile the kernel by yourself, add grub step by step. However, "kernel panic: VFS: unable to mount root FS on 0: 00 "error. What is the problem? (Chen Xu)
In general, the initrd file is not required on the desktop, but is required on servers with SCSI devices. It is possible that the initrd file is not generated during kernel compilation, so the above error message is displayed. You can use the mkinitrd command to generate an initrd. imgfile, add it to grub, and restart it for a try.

1156 how do I set the user's welcome information after logon? (Chen Xu)
Modify the/etc/motd file and write text to it, so that the user can log on correctly through Telnet and get the corresponding prompt information before executing shell.
Motd is "messages of the Day", that is, the meaning of the day information. The administrator can write some precautions or notifications to remind the formal users.

1157 I downloaded rcs5.7 and used it. /configure & make install the following error is reported :. /CONF. SH: Testing permissions .... /CONF. SH: This command shocould not be run with superuser permissions. I logged on to the compilation and installation as a root user. Why? (Chen Xu)
Some software cannot be compiled by the root user for security and other reasons. In this case, if the software is installed in the home directory of a user who is not compiled, you need to use the su command to convert to the root user and then execute make install.

1158 I failed to install usbview, details: # rpm-IVH usbview-1.0-9.src.rpm warning: usbview-1.0-9.src.rpm: V3 dsasignature: nokey, key idab42a60e (Chen Xu)
This line of code indicates that the installation failed because the appropriate key is not installed on your system to verify the signature. To verify the software package, you can import the public key of Red Hat by running the following command in shell:
# Rpm-import/usr/share/RHN/RPM-GPG-KEY
(Case Sensitive)

1159 how can I prevent a key file from being modified? (Chen Xu)
In Linux, some configuration files cannot be modified by anyone (including root. To prevent accidental deletion or modification, you can set "immutable" for the file )". The command is as follows:
# Chattr + I/etc/fstab
To modify the file, run the following command:
# Chattr-I/etc/fstab

1160 how to limit the number of processes that a user can start? (Chen Xu)
First, check whether the following row exists in the/etc/PAM. d/login file:
Session required/lib/security/pam_limits.so
Edit/etc/security/limits. conf, which can be set to limit the number of processes, CPU usage, and memory usage. For example, hard nproc 20 is to limit 20 processes. For details, see man.

1161 how do I limit the Shell Command record size? (Chen Xu)
By default, bash stores up to 500 Command records in the $ home/. bash_history file. The default number of records varies depending on the system. In the system, each user's home directory has such a file. To ensure system security, we strongly recommend that you limit the file size. You can edit the/etc/profile file and modify the options as follows:
Histfilesize = 30 or histsize = 30
In this way, the number of commands recorded is reduced to 30.

1162 What should I do if I want to keep the information displayed during the boot to check the computer's problems? (Chen Xu)
Enter the following command:
# Dmesg> bootmessage
This command will redirect the information displayed at startup to a file bootmessage.

1163 how can I delete the Command record when I log out? (Chen Xu)
Edit the/etc/skel/. bash_logout file and add the following lines:
Rm-F $ home/. bash_history
In this way, all users in the system will delete their command records when logging out.
If you only need to set a specific user, such as the root user, you can only modify the/$ home/. bash_history file in the user's home directory and add the same row.

1164 compile the kernel and support NTFS steps (platinum, Chen Xu)
1. # cd/usr/src/linux-2.4
2. # Make menuconfig
3. Select NTFS file system support (read only) under file system as M.
4. # uname-
2.4.21-27.0.2.el
5. # vi makefile
Ensure the first few actions
Version = 2
Patchlevel = 4
Sublevel = 21
Extraversion =-27.0.2.el
6. # Make Dep
7. # Make modules subdirs = FS/NTFS
8. # mkdir/lib/moduels/2.4.21-27.0.2.el/kernel/fs/NTFS
9. # cp-F fs/NTFS/*. O/lib/moduels/2.4.21-27.0.2.el/kernel/fs/NTFS/
10. # depmod-
11. # modprobe NTFS
12. # lsmod
Make sure there is NTFS in it

1165 how to use SSH Channel Technology (Chen Xu)
This article discusses that all machines are Linux operating systems.
For example, my machine is a, the intermediate server is B, and the target server is C.
From A to B, from B to C, but a cannot directly SSH to C.
Now we will use SSH channel technology to directly transfer files from A to C.
1. Ssh-l1234: C: 22 root @ B
Input B's password
2. SCP-p1234 filename root @ localhost:
Input C's password

1166 how to solve the problem of no response when using RPM commands (beginner photography)
Rm-RF/var/lib/RPM/_ dB .*

1167 send a message to all users logging on to the same server (Chen Xu)
1) enter Wall and press Enter.
2) enter the message to be sent
3) Press "control-d" at the end. The message is displayed in the user control window.

1168 enter a short message to a single user (Chen Xu)
1) Enter write username. When the user name appears on multiple terminals, you can add tty after the user name to indicate the user under which TTY.
2) enter the message to be sent.
3) Press "control-d" at the end, and the message is displayed in the user control window.
4) for the recipient, you can set whether to allow others to send messages to you.
Command Format: mesg n [y]
% Write liuxhello! Everybody, I 'llcome.
%
Message displayed in the user control window: Message from liux on ttyp1... Hello! Everybody, I 'llcome. EOF
When using window systems such as CDE or openwindows, each window is considered as a separate logon. If the number of user logins exceeds one, the message is sent directly to the control window.

1169 send messages in files to a single user (Chen Xu)
If a long message is sent to several users, use the file method:
1) Create the file filename of the Message Text to be sent.
2) Enter write username <FILENAME and press enter to create a file containing short messages using the cat command:
% Cat> messagehello! Everybody, I 'llcome.
% Write liux <messagewrite: liux logged in more than once... Write to console
% The user logs on in more than one window, and the message is displayed in the control window from liux on ttyp1... Hello! Everybody, I 'llcome. EOF

1170 send messages to all users on the remote machine (Chen Xu)
Use the rwall (Remote writing to everyone) command to send messages to all users in the network at the same time.
Rwall hostname File
When using window systems such as CDE or openwindows, each window is considered as a single login;
If the number of user logins exceeds one, the message is sent directly to the control window.
 

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.