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
才能讓剛才的更改生效。