一句话解决linux问题

来源:百度文库 编辑:神马文学网 时间:2024/10/01 08:43:21
1、rpm 没有反应
rm -f /var/lib/rpm/__* ; fuser -k /var/lib/rpm/*
2、grub安装错误
在执行grub-install /dev/sda时,如果显示为“/dev/sda does not have any corresponding BIOS drive. ”
那么先执行命令 grub-install --recheck /dev/sda
然后再执行 grub-install /dev/sda
3、Apache启动错误
When I tried to restart my apacher server, i kept getting this error:
Starting httpd: httpd: Could not determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
[root@myserver]# /etc/init.d/httpd restartStopping httpd:       [  OK  ]
Starting httpd:
httpd: Could not determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName                                                           [  OK  ]
THIS IS HOW YOU FIX THIS:
send the follwing two command. You must know your hostname and your domain name for this to work. if you have both, go ahead....
echo HOST.DOMAIN.com > /etc/hostname
HOST = Your host name
DOMAIN = Your Domain Name
/bin/hostname -F /etc/hostname
after I restart my server again, I didnt get the error anymore
hope this helps.
4. how to find the decleration in /usr/include:
> Hello,
>
> Does anyone know which header file defines
> sockaddr_storage?
$ find /usr/include -type f | xargs fgrep -nH sockaddr_storage
/usr/include/bits/socket.h:153:struct sockaddr_storage
5. The bootloader of RedHat  for Sparc is SILO(Sparc Improved boot LOader)
and type
linux single can enter the single user mode
6. 1KB = 1024 B
1MB = 1024 KB
1GB = 1024 MB
1TB = 1024 GB
7. How to float calculation?
echo "12 / 345" | bc -l
8. Why not color in VIM under SecureCRT?
1). make sure that vim-enhanced and vim-common have been installed.
2). make sure terminal->emulation: Linux and ANSI color are selected in SecureCRT
3). make sure TERM=linux or xterm, not vt100!
9. How to type ^M in VIM?
Ctrl v then Ctrl m
10. FTP login error:
[nms@wh-nms2 ~]$ ftp 219.243.213.139
Connected to 219.243.213.139.
421 Service not available.
ftp> bye
then check the /etc/hosts.allow in 219.243.213.139
ALL:166.111.247.192/255.255.255.192,202.38.120.240/255.255.255.240,219.243.213.128/255.255.255.248,219.243.214.1/255.255.255.
248
the red note should be changed to 219.243.213.136/255.255.255.248, which can then contain the 219.243.213.139/140, etc
finally, we can login with success:
[nms@wh-nms2 ~]$ ftp 219.243.213.139
Connected to 219.243.213.139.
220 (vsFTPd 1.1.3)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (219.243.213.139:nms): ftp
331 Please specify the password.
Password:
230 Login successful. Have fun.
Remote system type is UNIX.
Using binary mode to transfer files.
11 a little tip in ctags + vim
how to enable the recurse function?
ctags -R or --recurse(recommended) can generate a single "tag" file in the top directory, but this file contains all the tags under the top source code tree.
Then how to search in the sub-directory?
Edit the ~/.vimrc and add the
"set tags=tags;"  ---------the ";" is necessary!
then the vim will search the tag upward the upper directory.
12  can‘t access the MySQL DB,
$ ‘mysql -uroot -hlocalhost -p‘
$ can‘t access with "root@localhost" , permission denied
the reason behind it is almost certain be that : you forget the password of root for Database! Because the MySQL Database can be accessed by root with default.
then the problem becomes:
"How to obtain the forget root password of MySQL ?"
the steps is :
# killall -TERM myspld
# safe_mysqld --skip-grant-tables &
# mysql -u root
mysql > use mysql; update user set Password=password("new_password") where User="root" and Host="localhost"; flush privileges; quit
# killall -TERM mysqld
# service mysqld start
Then you can access the DB with root successfully.