linuxurl
❶ 在linux下,怎样获取本机浏览器中所有标签页的url
在命令符界面如何浏览网页可以使用lynx,links, w3m等软件
软件的使用方式都很类似,下面以w3m为例介绍如何安装使用:
1.安装w3m浏览器:sudo apt-get install w3m
2.使用w3m浏览网页:w3m url.xxx
❷ linux 下如何把URL编码转换
把这个保存成程序,比如
conv.pl:
perl
-e
'$a=<>;$a
=~
s/%([A-Fa-f0-9]{2})/pack('C',hex($1))/seg;
print
$a
.
"\n";
然后这样使用:
chmod
+x
conv.pl
echo
%E5%A5%A5%E8%BF%AA
|
./conv.pl
❸ linux中怎么访问一个URL,并将自己的IP传过去
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/select.h>
#define SIZE 1024
#define SERVER_PORT 80
int main(int argc, char *argv[])
{
int socket_fd, count;
char buf[SIZE];
struct sockaddr_in s_addr;
struct hostent *hent;
fd_set fdset;
struct timeval time_val;
if (argc != 2)
{
printf("usage: %s hostname\n", argv[0]);
return -1;
}
socket_fd = socket(AF_INET, SOCK_STREAM, 0);
if (socket_fd == -1)
{
printf("socket failed!\n");
return -1;
}
hent = gethostbyname(argv[1]);
bzero(&s_addr, sizeof(struct sockaddr_in));
s_addr.sin_family = AF_INET;
s_addr.sin_port = htons(SERVER_PORT);
s_addr.sin_addr.s_addr = inet_addr(inet_ntop(hent->h_addrtype, hent->h_addr_list[0], buf, sizeof(buf)));
connect(socket_fd, (struct sockaddr*)(&s_addr), sizeof(struct sockaddr));
count = snprintf(buf, SIZE, "GET / HTTP/1.1\r\nhost:%s\r\n\r\n", argv[1]);
write(socket_fd, buf, count);
FD_ZERO(&fdset);
FD_SET(socket_fd, &fdset);
time_val.tv_sec = 9;
time_val.tv_usec = 0;
count = select(socket_fd + 1, &fdset, NULL, NULL, &time_val);
if (count == 0)
{
printf("timeout\n");
return -1;
}
fcntl(socket_fd, F_SETFL, O_NONBLOCK);
while ((count = read(socket_fd, buf, SIZE - 1)) > 0)
{
buf[count] = 0;
printf("%s\n", buf);
}
close(socket_fd);
return 0;
}
❹ url linux 本机怎么写
url就是链接 比如下载网络主页 wget -c "www..com" -O index.html 这里的-c参数表示断点续传,-O表示输出文件(因为有的链接比较特殊,不能直接获取文件名),注意养成好习惯要加上引号,这是因为有的链接可能带有特殊符号,与shell有冲突
❺ linux 系统上的文件 如何生成下载链接,url之类的,
1、linux 系统上的文件 如何生成下载链接,url之类的,
❻ 在linux服务器下url地址怎么去掉index.php/home
一》在linux里面设置
1.打开apache的配置文件,conf/httpd.conf :
LoadMole rewrite_mole moles/mod_rewrite.so,把该行前的# 去掉 。
搜索 AllowOverride None(配置文件中有多处),看注释信息,将相关.htaccess的该行信息改为AllowOverride All。【其实apache 默认的都已经打开的】
2.在 CI 的根目录下,即在 index.php ,system的同级目录下,建立.htaccess,直接建立该文件名不会成功,可以先建立记事本文件,另存为该名的文件即可。内容如下( CI 手册上也有介绍):
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ / index.php /$1 [L]
如果文件不是在www的根目录下,例如是: http://localhost/nianyi_2011/ index.php ,第三行
需要改写为RewriteRule ^(.*)$ /nianyi_2011/ index.php /$1 [L]
另外,如果你的网站的根目录下面还有其他的文件夹,例:js,css,images,config等等文件夹,这需要过滤除去,第二行需要改写为:
RewriteCond $1 !^index\.php|images|js|css|config|robots\.txt)。
3.将 CI 中配置文件(application/config/config.php)中$config['index_page'] ="index.php ";改写成$config['index_page'] = "";
4.ok,完成。还要记得重启apache。
二》在 windows 里面开发
以上的配置在 windows 上面是不起任何作用的,所以我们在 windows 里面需要设置我们的apache的虚拟主机,在apache里面找到Apache-20\conf\extra\httpd-vhosts.conf 这个文件【我用的是服务是PHPnow,很多的人用wamp】,同样找到此文件,在里面修改,例:
# http://www.PHPnow.org
# filename: httpd-vhosts.conf
<Directory ../vhosts>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *
<VirtualHost *>
DocumentRoot ../htdocs
ServerName default:80
ErrorLog logs/default-error_log
</VirtualHost>
修改成:
# http://www.PHPnow.org
# filename: httpd-vhosts.conf
<Directory ../vhosts>
RewriteEngine on
RewriteCond $1 !^(index\.php|images|js|css|config|robots\.txt)
RewriteRule ^(.*)$ / index.php /$1 [L]
AllowOverride All
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *
<VirtualHost *>
DocumentRoot ../htdocs
ServerName default:80
ErrorLog logs/default-error_log
</VirtualHost>
也就是把路由写到这里面来。记得重新启动服务。
继续修改你的配置文件:
$config['enable_query_strings'] = true
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
把$config['enable_query_strings'] 修改成 false 这样就关闭了查询字符串形式 URL
现在你的文件的路径就可以写得了,例如:http://localhost/nianyi_2011/user/user_point
就相当于先前没有配置的路由: http://localhost/nianyi_2011/ index.php ?c=user&m=user_point 同样如果后面有参数的话,只用往后一次累加就好的了。
请注意:有时候我们这样写之后样式文件加载进来会有问题,找不到js css images等等目录,我们可以配置文件config.php里面设置$config['base_url'] = 'http://localhost/2011_11_cms/';站点的目录,接着我们在view模板文件<head></head>之间添加<base href="<?=base_url()?>" />,这样就能加载其他的文件的了
❼ linux里在命令行怎样得到url,并显示在终端里
在linux里面,使用curl命令可以将url的内容直接显示在终端,不过只有url是ascii码才能正确显示,如果是网页,将显示网页源代码,如果是二进制文件,将在终端显示乱码。
使用方法
在linux终端输入下面命令回车即可返回:
curl <curl> //其中<curl>就是网址。
curl是利用URL语法在命令行方式下工作的开源文件传输工具。它被广泛应用在Unix、多种Linux发行版中,并且有DOS和Win32、Win64下的移植版本。
❽ linux服务器,频繁被访问一个url,怎么解决
Linux系统中,如果需要禁止特定ip地址访问来保证系统的安全,只需通过操作iptalbes来实现,下面就给绍下Linux如何禁止某个ip地址访问。
一、概述
这两个文件是tcpd服务器的配置文件,tcpd服务器可以控制外部IP对本机服务的访问。这两个配置文件的格式如下:
#服务进程名:主机列表:当规则匹配时可选的命令操作
server_name:hosts-list[:command]
/etc/hosts.allow控制可以访问本机的IP地址,/etc/hosts.deny控制禁止访问本机的IP。如果两个文件的配置有冲突,以/etc/hosts.deny为准。
/etc/hosts.allow和/etc/hosts.deny两个文件是控制远程访问设置的,可以允许或者拒绝某个ip或者ip段的客户访问linux的某项服务。
比如SSH服务,通常只对管理员开放,那就可以禁用不必要的IP,而只开放管理员可能使用到的IP段。
二、配置
1、修改/etc/hosts.allow文件
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the ‘/usr/sbin/tcpd’ server.
#
sshd:210.13.218.*:allow
sshd:222.77.15.*:allow
all:218.24.129.110 #表示接受110这个ip的所有请求!
in.telnetd:140.116.44.0/255.255.255.0
in.telnetd:140.116.79.0/255.255.255.0
in.telnetd:140.116.141.99
in.telnetd:LOCAL
smbd:192.168.0.0/255.255.255.0 #允许192.168.0.网段的IP访问smbd服务
#sendmail:192.168.1.0/255.255.255.0
#pop3d:192.168.1.0/255.255.255.0
#swat:192.168.1.0/255.255.255.0
pptpd:all EXCEPT 192.168.0.0/255.255.255.0
httpd:all
vsftpd:all
以上写法表示允许210和222两个ip段连接sshd服务(这必然需要hosts.deny这个文件配合使用),当然:allow完全可以省略的。
ALL要害字匹配所有情况,EXCEPT匹配除了某些项之外的情况,PARANOID匹配你想控制的IP地址和它的域名不匹配时(域名伪装)的情况。
2、修改/etc/hosts.deny文件
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the ‘/usr/sbin/tcpd’ server.
#
# The portmap line is rendant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd:all:deny
in.telnet:ALL
ALL:ALL EXCEPT 192.168.0.1/255.255.255.0,192.168.1.21,
202.10.5.0/255.255.255.0
注意看:sshd:all:deny表示拒绝了所有sshd远程连接。:deny可以省略。
3、启动服务。
注意修改完后:
#service xinetd restart
才能让刚才的更改生效。