當前位置:首頁 » 幣種行情 » eth1234567

eth1234567

發布時間: 2022-04-30 07:23:59

A. C語言問題,急救.

1. 用isalpha(stu[i].num[j]) 和 isdigit(stu[i].num[j])

do{
key = 1;
for(i=0; i<2 && key = 1; i++)
if(!isalpha(input[i]))
key=0;
for(i=2; i<9 && key = 1; i++)
if(!isdigit(input[i]))
key=0;
if(key == 1)
strcpy(stu[j].num, input)
}while(key==0);

2. 當拿x值是用 x=toupper(getchar());
while(x != 'Y' || x != 'N'){
printf("Invalid value pls enter again[y]yes [n] no> ");
x=toupper(getchar());
}

3.當然你的學號需要改成string
#include<string.h>里的
if(strcmp(input,stu[i].num) == 0)
這表示他們兩個是一樣的

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#define N 5

struct student{
char num[10]; //ѧºÅ
char name[10]; //ÐÕÃû³¤¶È
float score1;
float score2;
float score3;
float score; //ƽ¾ù³É¼¨
}stu[N]={
{"1", "Àî1",45,45,45,45},
{"2", "Àî2",46,46,46,46},
{"3", "Àî3",47,47,47,47},
{"4", "Àî4",48,48,48,48},
{"5", "Àî5",49,49,49,49}};

del();
int chacknum(char*);
int scan(char*, int*);

int i,m;

void main(){
for (i=0;i<N;i++){
printf("ѧºÅ%d \nÐÕÃû%s\n³É¼¨1%7.2f\n³É¼¨2%7.2f\n³É¼¨3%7.2f\nƽ¾ù³É¼¨%7.2f\n",
stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].score);
}
del();
}

del(){
char x;
char input[10];
int j,i=N;

for(;;){
printf("ɾ³ýѧÉúÐÅÏ¢\n");
printf("ÊÇ·ñɾ³ýѧÉúÐÅÏ¢(y/n)");
fflush(stdin);
x=toupper(getchar());
while(x != 'Y' && x != 'N'){
printf("You are enter invalid value pls enter again > ");
fflush(stdin);
x=toupper(getchar());
}
printf("\n");
if(x=='Y'){
printf("ÊäÈëҪɾ³ýѧԱѧºÅ:");
fflush(stdin);
gets(input);
printf("\n");
if(scan(input, &j) == 0){
printf("No this ID\n");
continue;
}
i--;
for(;;){
stu[j]=stu[j+1];
j++;
if(!strlen(stu[j].num))
break;
}
for(j=0;j<i;j++)
if (stu[j].num!=0)
printf("ѧºÅ%s \nÐÕÃû%s\n³É¼¨1%7.2f\n³É¼¨2%7.2f\n³É¼¨3%7.2f\nƽ¾ù³É¼¨%7.2f\n",
stu[j].num,stu[j].name,stu[j].score1,stu[j].score2,stu[j].score3,stu[j].score);
}else if(x == 'N')
break;
system("pause");
system("cls");
}
}

int chacknum(char num[]){
int key=1, i;
if(strlen(num) != 9)
key = 0;
for(i=0; i<2 && key == 1; i++)
if(!isalpha(num[i]))
key = 0;
for(i=2; i<9 && key == 1; i++)
if(!isdigit(num[i]))
key = 0;
return key;
}

int scan(char input[], int *j){
int i, key = 0;
for(i=0; i<5 && key == 0; i++)
if(strcmp(stu[i].num,input) == 0){
key = 1;
break;
}
*j = i;
return key;
}

B. 漢字諧音的對聯有哪些

謝謝你發來的求助,我感到非常榮幸,這是我找到的一些資料,希望能夠幫到你!

二猿斷木深山中,小猴子也敢對鋸(句)
一馬陷足污泥內,老畜生怎能出題(蹄) --解 縉

因荷而得藕,(因何而得偶)
有杏不須梅,(有幸不須媒)

狗啃河上(和尚)骨 --蘇 軾
水流東坡詩(屍) --佛 印

向陽門第春常在 --蘇 軾
積善人家慶(罄)有餘(魚) --佛 印

師姑田上擔禾上(和尚)
美女堂前抱綉裁(秀才)

孔子生於舟(周)未
光舞(武)起自漢中 光舞:閃電;漢中:天空

燈籠籠燈,紙(枳)殼原來只防風
鼓架架鼓,陳皮不能敲半下(夏)

蓮(連)子心中苦
梨(離)兒腹內酸 --金聖嘆

身居寶塔,眼望孔明,怨江圍實難旅步
鳥處籠中,心思槽巢,恨關羽不得張飛 --(內江三元塔楹聯)
孔明(諸葛亮)江圍(姜維)旅步(呂布)槽巢(曹操)關羽 張飛
兩舟競渡,櫓速不如帆快
百管爭鳴,笛清難比蕭和
櫓速、帆快、笛清、蕭和分別諧音三國人物:魯肅,攀噲,狄青,蕭何

上聯:和尚過河,手掣荷花何處插?
下聯:侍郎游市,眼前柿樹是誰栽?
新聯:委員入闈,臉上威風為甚猥!(無情)

上聯:何所長,何所長,何所長因何當所長。

上聯:先生磨墨,墨濺先生兩脈墨。
下聯:枚香燒煤,煤爆枚香雙眉煤。
下聯:牧童伐木,木傷牧童二目木。

上聯:樹上桐子,樹下童子,童子打桐子,桐子落童子樂。
下聯:屋前園外,屋內員外,員外掃園外,園外凈員外靜。
新聯:院後廊中,院里郎中,郎中行廊中,廊中幽郎中悠。(無情)

上聯:蒲葉桃葉葡萄葉,草本木本。
下聯:梅花桂花玫瑰花,春香秋香。

上聯:霜降降霜,誰憐孀婦雙腳冷。
下聯:穀雨雨谷,我惜姑娘孤身寒。

上聯:寶塔六七層,中容大鶴。
下聯:通書十二頁,里記春秋。
新聯:家譜四五筆,上書老子。

調琴調新調調調調來調調妙
種花種好種種種種成種種香

上聯:一、三、八字讀音 (條),調整的 (調),其餘讀音(掉),音調的(調)。
下聯:一、三、八字讀去音,種植的 (種),其餘讀上音,品種,種類的(種)。

朝朝朝朝朝朝汐
長長長長長長消

上聯讀音:朝朝潮,朝潮朝汐。
下聯讀音:長長漲,長漲長消。

行行行行行行行
長長長長長長長

上聯讀音:杭行杭行杭杭行。
下聯讀音:長漲長漲長長漲。

樂樂樂樂樂樂樂
朝朝朝朝朝朝朝

上聯讀音:駱曰,駱曰,駱駱曰。
下聯讀音:招潮,招潮,招招潮。

朝雲朝朝朝朝朝朝朝退
長水長長長長長長長流

上聯讀音:朝雲潮,朝朝潮,朝朝朝退。
下聯讀音:長水漲,長長漲,長漲長流。

海水朝朝朝朝朝朝朝落
浮雲長長長長長長長消

上聯讀音:海水潮,朝朝潮,朝潮朝落。
下聯讀音:浮雲漲,長長漲,長漲長消。

酒熱不須湯盞湯
廳來無用扇車扇

上聯後一「湯」讀「燙」
下聯後一「扇」讀「煽」

C. 1234567的英語的基數詞的序數詞

a.從第一至第十九
其中,one-first,two-second,three-third,five-fifth,eight-eighth,nine-ninth,twelve-twelfth為特殊形式,其它的序數詞都是由其相對應的基數詞後面添加「th」構成。例如:six-sixth、nineteen-nineteenth.
b.從第二十至第九十九
整數第幾十的形式由其對應的基數詞改變結尾字母y為i,再加「eth」構成。
twenty--twentieththirty--thirtieth
表示第幾十幾時,用幾十的基數詞形式加上連字元「-」和個位序數詞形式一起表示。
thirty-first第三十一
fifty-sixth第五十六
seventy-third第七十三
ninety-ninth第九十九

D. 青少年電子手錶的1234567 7天的日期怎麼調

從最出界面開始,顯示的是時間 SUMOTUWETHFRSR 星期日星期一星期二星期三星期四星期五星期六 LIGHT:燈光 1按一次MODE進入秒錶 1.1按一次ST/SP開始計時,再按ST/SP停止計時 2按二次MODE進入鬧鍾調整 2.1按RESET更改選項,按ST/SP調整時間 3按三次MODE進入時間日期星期調整 3.1、按ST/SP調整秒 3.2、按一次RESET,按ST/SP調整分 3.3、按二次RESET,按ST/SP調整小時(可以選擇12小時的或24小時的) 3.4、按三次RESET,按ST/SP調整日 3.5、按四次RESET,按ST/SP調整月 3.6、按五次RESET,按ST/SP調整星期 鬧鍾調整:從最出界面開始,同按時按ST/SP和RESET是鬧鍾開關,同時要注意 上面會有個小鈴鐺圖案或別的顯示鬧鍾開關。鬧鍾響後按RESET關 閉鬧鍾,若按ST/SP暫時停止鬧鍾,五分鍾後會在響。

E. flash鍵盤鋼琴 1234567=鍵盤英文

你是要KEYCODE是吧。。。。

keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space
keycode 33 = Prior
keycode 34 = Next
keycode 35 = End
keycode 36 = Home
keycode 37 = Left
keycode 38 = Up
keycode 39 = Right
keycode 40 = Down
keycode 41 = Select
keycode 42 = Print
keycode 43 = Execute
keycode 45 = Insert
keycode 46 = Delete
keycode 47 = Help
keycode 48 = 0 equal braceright
keycode 49 = 1 exclam onesuperior
keycode 50 = 2 quotedbl twosuperior
keycode 51 = 3 section threesuperior
keycode 52 = 4 dollar
keycode 53 = 5 percent
keycode 54 = 6 ampersand
keycode 55 = 7 slash braceleft
keycode 56 = 8 parenleft bracketleft
keycode 57 = 9 parenright bracketright
keycode 65 = a A
keycode 66 = b B
keycode 67 = c C
keycode 68 = d D
keycode 69 = e E EuroSign
keycode 70 = f F
keycode 71 = g G
keycode 72 = h H
keycode 73 = i I
keycode 74 = j J
keycode 75 = k K
keycode 76 = l L
keycode 77 = m M mu
keycode 78 = n N
keycode 79 = o O
keycode 80 = p P
keycode 81 = q Q at
keycode 82 = r R
keycode 83 = s S
keycode 84 = t T
keycode 85 = u U
keycode 86 = v V
keycode 87 = w W
keycode 88 = x X
keycode 89 = y Y
keycode 90 = z Z
keycode 96 = KP_0 KP_0
keycode 97 = KP_1 KP_1
keycode 98 = KP_2 KP_2
keycode 99 = KP_3 KP_3
keycode 100 = KP_4 KP_4
keycode 101 = KP_5 KP_5
keycode 102 = KP_6 KP_6
keycode 103 = KP_7 KP_7
keycode 104 = KP_8 KP_8
keycode 105 = KP_9 KP_9
keycode 106 = KP_Multiply KP_Multiply
keycode 107 = KP_Add KP_Add
keycode 108 = KP_Separator KP_Separator
keycode 109 = KP_Subtract KP_Subtract
keycode 110 = KP_Decimal KP_Decimal
keycode 111 = KP_Divide KP_Divide
keycode 112 = F1
keycode 113 = F2
keycode 114 = F3
keycode 115 = F4
keycode 116 = F5
keycode 117 = F6
keycode 118 = F7
keycode 119 = F8
keycode 120 = F9
keycode 121 = F10
keycode 122 = F11
keycode 123 = F12
keycode 124 = F13
keycode 125 = F14
keycode 126 = F15
keycode 127 = F16
keycode 128 = F17
keycode 129 = F18
keycode 130 = F19
keycode 131 = F20
keycode 132 = F21
keycode 133 = F22
keycode 134 = F23
keycode 135 = F24
keycode 136 = Num_Lock
keycode 137 = Scroll_Lock
keycode 187 = acute grave
keycode 188 = comma semicolon
keycode 189 = minus underscore
keycode 190 = period colon
keycode 192 = numbersign apostrophe
keycode 210 = plusminus hyphen macron
keycode 211 =
keycode 212 = right registered
keycode 213 = guillemotleft guillemotright
keycode 214 = masculine ordfeminine
keycode 215 = ae AE
keycode 216 = cent yen
keycode 217 = questiondown exclamdown
keycode 218 = onequarter onehalf threequarters
keycode 220 = less greater bar
keycode 221 = plus asterisk asciitilde
keycode 227 = multiply division
keycode 228 = acircumflex Acircumflex
keycode 229 = ecircumflex Ecircumflex
keycode 230 = icircumflex Icircumflex
keycode 231 = ocircumflex Ocircumflex
keycode 232 = ucircumflex Ucircumflex
keycode 233 = ntilde Ntilde
keycode 234 = yacute Yacute
keycode 235 = oslash Ooblique
keycode 236 = aring Aring
keycode 237 = ccedilla Ccedilla
keycode 238 = thorn THORN
keycode 239 = eth ETH
keycode 240 = diaeresis cedilla currency
keycode 241 = agrave Agrave atilde Atilde
keycode 242 = egrave Egrave
keycode 243 = igrave Igrave
keycode 244 = ograve Ograve otilde Otilde
keycode 245 = ugrave Ugrave
keycode 246 = adiaeresis Adiaeresis
keycode 247 = ediaeresis Ediaeresis
keycode 248 = idiaeresis Idiaeresis
keycode 249 = odiaeresis Odiaeresis
keycode 250 = udiaeresis Udiaeresis
keycode 251 = ssharp question backslash
keycode 252 = asciicircum degree
keycode 253 = 3 sterling
keycode 254 = Mode_switch 本篇文章來源於:開發學院 http://e.codepub.com 原文鏈接:http://e.codepub.com/2009/0416/2997.php

F. linux 怎麼解決failed to update rate sets in kernel mole

Cybergibbons
Reverse engineer, hardware hacker, security analyst, lock picker, heist planner. Definitely not involved in the Hatton Garden job.
Search
Menu
SKIP TO CONTENT
HOME
ABOUT
BENEFITS
CONTACT
PGP KEY

Quick and easy fake WiFi access point in Kali
POSTED ON FEBRUARY 4, 2015 BY CYBERGIBBONS
I』m working on a project at the moment that requires me to observe traffic from an iOS/Android app to various external IPs.
The easiest way to do this is to setup a fake WiFi access point and use Wireshark to sniff the traffic. This is very easy in Kali Linux.
1. Connect the Kali box to the Internet
On my machine, this is as simple as connecting to my WiFi network 「DoingAJob5G」 using the built-in wireless card on my x220. I use the GUI provided with Kali.
Using ifconfig I can see that this adapter is called wlan0.
You could use wired Ethernet, then in all likelihood this will be eth0 instead.
2. Connect an external WiFi adapter that is supported by hostapd
I』m using a USB TP-LINK TL-WN722N which is using an Atheros AR9271 chipset. These are cheap (£8-£10), powerful and reliable.
I suspect many USB WiFi adapters are compatible with hostapd, unfortunately I can』t see a clear source documenting which ones.
Check it works by connecting to any network using Kali』s GUI. This will save you hassle later if there are any driver or hardware issues.
3. Bring up the new wireless interface.
Use ifconfig -a to see the new wireless interface name:

1
2
3
4
5
6

wlan3 Link encap:Ethernet HWaddr c0:4a:00:1e:64:fd
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Bring this up as the gateway for your new wireless network. I am using 10.0.0.1/24 simply to avoid any chance of confusion with my internal NATed 192.168.0.1/24 network.

1
2
3
4
5
6
7
8
9

root@kali:~# ifconfig wlan3 10.0.0.1/24 up
root@kali:~# ifconfig wlan3
wlan3 Link encap:Ethernet HWaddr c0:4a:00:1e:64:fd
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

4. Configure and run DHCP and DNS services
DHCP assigns IP addresses when clients connect, and DNS provides resolution of names to IPs.
Most wireless clients expect DHCP by default, so it is convenient to run a DHCP server. You can manually set IP addresses, but it』s really easier to do DHCP.
Running our own DNS server means that we can easily intercept and alter DNS queries, which can assist in setting up man-in-the-middle attacks.
A piece of software called dnsmasq does both DHCP and DNS and is very simple to setup.
First, install dnsmasq:

1

apt-get install dnsmasq

Next, create a config file dnsmasq.conf as follows:

1
2
3
4
5
6
7

interface=wlan3
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
server=8.8.8.8
log-queries
log-dhcp

This is about as simple as it gets. Only listen on wlan3, our additional wireless adapter. Hand out DHCP addresses from 10.0.0.10-10.0.0.250. DHCP option 3 is the gateway, DHCP option 6 is the DNS server – both of these should be set to our wlan3 IP of 10.0.0.1. serverspecifies upstream DNS servers that will handle most DNS queries – I have provided Google』s DNS server of 8.8.8.8. Finally, log DNS queries and DHCP requests – this just makes it easier to check everything is working.
We also want to create a file fakehosts.conf to allow us to spoof certain DNS requests:

1

10.0.0.9 neohub.co.uk

This will cause the dnsmasq DNS server to respond with 10.0.0.9 to any request forneohub.co.uk.
We then need to bring dnsmasq up. I want it to run with output to stderr, so this is done as follows:

1

dnsmasq -C dnsmasq.conf -H fakehosts.conf -d

5. Configure and run hostapd
Next, we need to get our wireless adapter to run as a access point.
hostapd allows us to do this.
Install hostapd:

1

apt-get install hostapd

Create a config file hostapd.conf:

1
2
3
4

interface=wlan3
driver=nl80211
ssid=Kali-MITM
channel=1

Again – really simple. Use our additional wireless adapter wlan3 with the nl80211 drivers (which seem to cover pretty much all modern adapters than can be APs), set the SSID to Kali-MITM and set the channel to 1. There is no encryption etc. but I really don』t need or want it for sniffing traffic.
Then start hostapd:

1
2
3
4

root@kali:~# hostapd ./hostapd.conf
Configuration file: ./hostapd.conf
Failed to update rate sets in kernel mole
Using interface wlan3 with hwaddr c0:4a:00:1e:64:fd and ssid 'Kali-MITM'

6. Setup routing for the access point
You want a very simple setup at the moment – act as a basic NAT gateway between wlan3and wlan0.
Without going into any detail, the following commands will set this up:

1
2
3

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -P FORWARD ACCEPT
sudo iptables --table nat -A POSTROUTING -o wlan0 -j MASQUERADE

At this stage, you should now be able to connect to Kali-MITM, get an IP address, and start using the Internet.

G. ubuntu 如何修改網卡名稱

方案一:
1,首先修改網卡物理配置文件,沒有這個文件的話新建一個或者從已有的環境上拷貝一份過來按照要求進行修改
vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x14e4:0x1692 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="bc:30:5b:b1:cd:be", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

關鍵字解釋:
ATTR{address}=="bc:30:5b:9c:ae:79" ##物理網卡MAC地址 ifconfig查看
KERNEL=="eth*" ##原網卡名
NAME="eth0" ##現網卡名1234567

需要把這個文件中網卡的MAC地址,原網卡名字以及需要改成的網卡名字配置進去。
2,修改網落配置文件
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 172.16.19.XX
netmask 255.255.255.0

這個要配置成修改後新的網卡名字
auto eth0 ##網卡名對應要正確1234567

3,重啟伺服器
重啟物理伺服器有一定的風險伺服器沒有重啟起來,個人測試環境比較老舊有出現過伺服器重啟不起來,或者重啟起來伺服器因為網路配置錯誤出現失聯情況,提示:在進行網卡修改的時候最好伺服器離自己比較近,不要在遠程的方式下進行修改,防止伺服器失聯。
三、方案二:
在/etc/default/grub中,GRUB_CMDLINE_LINUX里添加參數net.ifnames=0 biosdevname=0,如下圖所示:

然後在命令行執行,update-grub,最後,修改/etc/network/interfaces文件,
將網卡名改為eth0
重啟系統,網卡名更改成功,當然這里也會出現伺服器失聯的情況需要注意。
閱讀全文

H. linux運維工程師面試問不問面試題

1

mount.cifs //192.168.1.3/server /mnt/server -o user=administrator,pass=123456

linux 下的server需要自己手動建一個 後面的user與pass 是windows主機的賬號和密碼 注意空格 和逗號
2.查看http的並發請求數與其TCP連接狀態

Shell

1

netstat -n | awk '/^tcp/ {++b[$NF]} END {for(a in b) print a, b[a]}'

還有ulimit -n 查看linux系統打開最大的文件描述符,這里默認1024,不修改這里web伺服器修改再大也沒用。若要用就修改很幾個辦法,這里說其中一個:
修改/etc/security/limits.conf

Shell

1
2

* soft nofile 10240
* hard nofile 10240

重啟後生效
3.用tcpmp嗅探80埠的訪問看看誰最高

Shell

1

tcpmp -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -5

4.查看當前系統每個IP的連接數

Shell

1

ls /var/log/ -lR| grep "^-" |wc -l

5.查看當前系統每個IP的連接數

Shell

1

netstat -n | awk '/^tcp/ {print $5}'| awk -F: '{print $1}' | sort | uniq -c | sort -rn

6.shell下32位隨機密碼生成

Shell

1

cat /dev/urandom | head -1 | md5sum | head -c 32 >> /pass

將生成的32位隨機數 保存到/pass文件里了
7.統計出apache的access.log中訪問量最多的5個IP

Shell

1

cat access_log | awk '{print $1}' | sort | uniq -c | sort -n -r | head -5

8.如何查看二進制文件的內容
我們一般通過hexmp命令 來查看二進制文件的內容。
hexmp -C XXX(文件名) -C是參數 不同的參數有不同的意義
-C 是比較規范的 十六進制和ASCII碼顯示
-c 是單位元組字元顯示
-b 單位元組八進制顯示
-o 是雙位元組八進制顯示
-d 是雙位元組十進制顯示
-x 是雙位元組十六進制顯示
等等等等
9.ps aux 中的VSZ代表什麼意思,RSS代表什麼意思
VSZ:虛擬內存集,進程佔用的虛擬內存空間
RSS:物理內存集,進程戰用實際物理內存空間
10.檢測並修復/dev/hda5
fsck用來檢查和維護不一致的文件系統。若系統掉電或磁碟發生問題,可利用fsck命令對文件系統進行檢查,用法:

11.Linux系統的開機啟動順序

載入BIOS–>讀取MBR–>Boot Loader–>載入內核–>用戶層init一句inittab文件來設定系統運行的等級(一般3或者5,3是多用戶命令行,5是界面)–>init進程執行rc.syninit–>啟動內核模塊–>執行不同級別運行的腳本程序–>執行/etc/rc.d/rc.local(本地運行服務)–>執行/bin/login,就可以登錄了。
12.符號鏈接與硬鏈接的區別
我們可以把符號鏈接,也就是軟連接 當做是 windows系統里的 快捷方式。
硬鏈接 就好像是 又復制了一份.
ln 3.txt 4.txt 這是硬鏈接,相當於復制,不可以跨分區,但修改3,4會跟著變,若刪除3,4不受任何影響。
ln -s 3.txt 4.txt 這是軟連接,相當於快捷方式。修改4,3也會跟著變,若刪除3,4就壞掉了。不可以用了。
13.保存當前磁碟分區的分區表
dd 命令是以個強大的命令,在復制的同時進行轉換

Shell

1

dd if=/dev/sda of=./mbr.txt bs=1 count=512

14..沒有14題,我自己來個簡單的,如何在文本裡面進行復制、粘貼,刪除行,刪除全部,按行查找和按字母查找。
以下操作全部在命令行狀態操作,不要在編輯狀態操作。
在文本里 移動到想要復制的行 按yy 想復制到哪就移動到哪,然後按P 就黏貼了
刪除行 移動到改行 按dd
刪除全部 dG 這里注意G一定要大寫
按行查找 :90 這樣就是找到第90行
按字母查找 /path 這樣就是 找到path這個單詞所在的位置,文本里可能存在多個,多次查找會顯示在不同的位置。
15.手動安裝grub

Shell

1

grub-install /dev/sda

16.修改內核參數
vi /etc/sysctl.conf 這里修改參數
sysctl -p 刷新後可用
17.在1-39內取隨機數

Shell

1

echo $[$RANDOM%39]

RANDOM 隨機數
%39 取余數
18.限制apache每秒新建連接數為1,峰值為3
每秒新建連接數 一般都是由防火牆來做,apache本身好像無法設置每秒新建連接數,只能設置最大連接:

Shell

1

iptables -A INPUT -d 172.16.100.1 -p tcp --dport 80 -m limit --limit 1/second -j ACCEPT

硬體防火牆設置更簡單,有界面化,可以直接填寫數字。。。
最大連接 apache本身可以設置
MaxClients 3 ,修改apache最大連接 前提還是要修改系統默認tcp連接數。我博客里也說了,這就不說了。
19.FTP的主動模式和被動模式
FTP協議有兩種工作方式:PORT方式和PASV方式,中文意思為主動式和被動式。
PORT(主動)方式的連接過程是:客戶端向伺服器的FTP埠(默認是21)發送連接請 求,伺服器接受連接,建立一條命令鏈路。當需要傳送數據時,客戶端在命令鏈路上用PORT 命令告訴伺服器:「我打開了XX埠,你過來連接我」。於是伺服器從20埠向客戶端的 XX埠發送連接請求,建立一條數據鏈路來傳送數據。
PASV(被動)方式的連接過程是:客戶端向伺服器的FTP埠(默認是21)發送連接請 求,伺服器接受連接,建立一條命令鏈路。當需要傳送數據時,伺服器在命令鏈路上用PASV 命令告訴客戶端:「我打開了XX埠,你過來連接我」。於是客戶端向伺服器的XX埠 發送連接請求,建立一條數據鏈路來傳送數據。
從上面可以看出,兩種方式的命令鏈路連接方法是一樣的,而數據鏈路的建立方法就完 全不同。
20.顯示/etc/inittab中以#開頭,且後面跟了一個或者多個空白字元,而後又跟了任意非空白字元的行

Shell

1

grep "^# \{1,\}[^ ]" /etc/inittab

21.顯示/etc/inittab中包含了:一個數字:(即兩個冒號中間一個數字)的行

Shell

1

grep "\:[0-9]\{1\}\:" /etc/inittab

22.怎麼把腳本添加到系統服務里,即用service來調用
在腳本里加入

Shell

1
2
3

#!/bin/bash
# chkconfig: 345 85 15
# description: httpd

然後保存
chkconfig httpd –add 創建系統服務
現在就可以使用service 來 start or restart
23.寫一個腳本,實現批量添加20個用戶,用戶名為user1-20,密碼為user後面跟5個隨機字元

Shell

1
2
3
4
5
6

#!/bin/bash
#description: useradd
for i in `seq -f"%02g" 1 20`;do
useradd user$i
echo "user$i-`echo $RANDOM|md5sum|cut -c 1-5`"|passwd –stdinuser$i >/dev/null 2>&1
done

24.寫一個腳本,實現判斷192.168.1.0/24網路里,當前在線的IP有哪些,能ping通則認為在線

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13

#!/bin/bash
for ip in `seq 1 255`
do
{
ping -c 1 192.168.1.$ip > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 192.168.1.$ip UP
else
echo 192.168.1.$ip DOWN
fi
}&
done
wait

25.寫一個腳本,判斷一個指定的腳本是否是語法錯誤;如果有錯誤,則提醒用戶鍵入Q或者q無視錯誤並退出其它任何鍵可以通過vim打開這個指定的腳本

Shell

1
2
3
4
5
6
7
8
9
10
11
12

[root@localhost tmp]# cat checksh.sh
#!/bin/bash
read -p "please input check script->" file
if [ -f $file ]; then
sh -n $file > /dev/null 2>&1
if [ $? -ne 0 ]; then
read -p 「You input $file syntax error,[Type q to exit or Type vim toedit]」 answer
case $answer in
q | Q)
exit 0
;;
vim)

26、寫一個腳本:(26包括3個小題)
1、創建一個函數,能接受兩個參數:
1)第一個參數為URL,即可下載的文件;第二個參數為目錄,即下載後保存的位置;
2)如果用戶給的目錄不存在,則提示用戶是否創建;如果創建就繼續執行,否則,函數返回一個51的錯誤值給調用腳本;
3)如果給的目錄存在,則下載文件;下載命令執行結束後測試文件下載成功與否;如果成功,則返回0給調用腳本,否則,返回52給調用腳本;

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

[root@localhost tmp]# cat downfile.sh
#!/bin/bash
url=$1
dir=$2
download()
{
cd $dir >> /dev/null 2>&1
if [ $? -ne 0 ];then
read -p "$dir No such file or directory,create?(y/n)" answer
if [ "$answer" == "y" ];then
mkdir -p $dir
cd $dir
wget $url 1> /dev/null 2>&1
if [ $? -ne 0 ]; then
return "52"
fi
else
return "51"
fi
fi
}
download $url $dir
echo $?

27、寫一個腳本:(27包括2個小題)
1、創建一個函數,可以接受一個磁碟設備路徑(如/dev/sdb)作為參數;在真正開始後面步驟之前提醒用戶有危險,並讓用戶選擇是否繼續;而後將此磁碟設備上的所有分區清空(提示,使用命令dd if=/dev/zero of=/dev/sdb bs=512 count=1實現,注意其中的設備路徑不要寫錯了;
如果此步驟失敗,返回67給主程序;
接著在此磁碟設備上創建兩個主分區,一個大小為100M,一個大小為1G;如果此步驟失敗,返回68給主程序;
格式化此兩分區,文件系統類型為ext3;如果此步驟失敗,返回69給主程序;
如果上述過程都正常,返回0給主程序;
2、調用此函數;並通過接收函數執行的返回值來判斷其執行情況,並將信息顯示出來;

Shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

local Darray=(`ls /dev/sd[a-z]`)
for i in ${Darray};do
[[ "$i" == "$1" ]] && Sd=$i &&break
done
else
return66
fi
#當匹配成功,進入選擇,告訴用戶,是否繼續,輸錯的話進入無限循環,當用戶選擇Y,則清空目標分區,且跳出while循環
while :;do
read -p "Warning!!!This operation will clean $Sd data.Next=y,Quit=n [y|n]:" Choice
case $Choice in
y)
dd if=/dev/zero of=$Sd bs=512 count=1 &> /dev/null &&break || return 67 ;;
n)
exit 88 ;;
*)
echo "Invalid choice,please choice again." ;;
esac
done

#使用echo傳遞給fdisk進行分區,如果此命令失敗,則跳轉出去,錯誤值68,需要注意的是,有時候這個返回值很詭異,筆者之前成功與否都是返回的1,後來重啟之後,就好了,如果慎重的話,可以對創建的分區,進行判斷,不過就需要使用其他工具截取相關欄位了,雖有些小麻煩,但無大礙

Shell

1

echo-e "n\np\n1\n\n+100M\nn\np\n2\n\n+1024M\nw\n"|fdisk /dev/sdb&> /dev/null || return 68

#格式化之前,讓內核重新讀取磁碟分區表,值得注意的是,有的系統版本,使用partprobe無效,譬如筆者的環境是rhel5.8,而rhel6.0以後,這個命令就很危險了,而使用partx -a /dev/sdb則效果更好…此項需慎重,如果格式化失敗,則告知把失敗的分區定義成變數,且跳出函數,並帶出錯誤值69

Shell

1
2
3
4
5
6
7

`partprobe`
Part=`fdisk -l /dev/$Sd|tail -2|cut -d」 」 -f1`
for M in ${Part};do
mke2fs -j $M &> /dev/null && ErrorPart=$M &&return 69
done
return 0
}

#下面代碼,調用函數,接收函數返回值,根據返回值進行判斷哪裡出錯。

Shell

1
2
3
4
5
6
7

Disk_Mod $1
Res=$?
[ $Res-eq 0 ] && exit 0
[ $Res-eq 66 ] && echo "Error! Invalid input."
[ $Res-eq 67 ] && echo "Error! Command -> dd <- Faild."
[ $Res-eq 68 ] && echo "Error! Command -> fdisk <- Faild."
[ $Res-eq 69 ] && echo "Error! Command -> mke2fs <- Faild."

熱點內容
一億枚usdt 發布:2025-05-22 04:55:26 瀏覽:7
比特幣ios 發布:2025-05-22 04:42:13 瀏覽:112
去長春疾病控制中心需要掛號 發布:2025-05-22 04:39:15 瀏覽:305
ofc數字貨幣交易系統癱瘓 發布:2025-05-22 04:38:23 瀏覽:228
l比特幣微信群 發布:2025-05-22 04:36:17 瀏覽:775
做比特幣期貨怎麼樣 發布:2025-05-22 04:33:02 瀏覽:85
比特幣solo挖礦 發布:2025-05-22 04:22:11 瀏覽:950
疫苗區塊鏈未來的發展 發布:2025-05-22 04:19:24 瀏覽:61
合約怎麼看MACD 發布:2025-05-22 04:17:58 瀏覽:219
USDT多少枚 發布:2025-05-22 04:08:40 瀏覽:482