学习/linux/list.h_双链表实现

linux-3.5/include/linux/list.h

使用只含指针域的双向循环链表进行链表的操作。

下面是我选取部分list.h中代码:

  1 #ifndef _LINUX_LIST_H
  2 #define _LINUX_LIST_H
  3
  4 struct list_head {
  5     struct list_head *next, *prev;
  6 };
  7 /*
  8  * Simple doubly linked list implementation.
  9  *
 10  * Some of the internal functions ("__xxx") are useful when
 11  * manipulating whole lists rather than single entries, as
 12  * sometimes we already know the next/prev entries and we can
 13  * generate better code by using them directly rather than
 14  * using the generic single-entry routines.
 15  */
 16
 17 #define LIST_HEAD_INIT(name) { &(name), &(name) }
 18
 19 #define LIST_HEAD(name)  20     struct list_head name = LIST_HEAD_INIT(name)
 21
 22 static inline void INIT_LIST_HEAD(struct list_head *list)
 23 {
 24     list->next = list;
 25     list->prev = list;
 26 }
 27
 28 /*
 29  * Insert a new entry between two known consecutive entries.
 30  *
 31  * This is only for internal list manipulation where we know
 32  * the prev/next entries already!
 33  */
 34 #ifndef CONFIG_DEBUG_LIST
 35 static inline void __list_add(struct list_head *new,
 36                   struct list_head *prev,
 37                   struct list_head *next)
 38 {
 39     next->prev = new;
 40     new->next = next;
 41     new->prev = prev;
 42     prev->next = new;
 43 }
 44 #else
 45 extern void __list_add(struct list_head *new,
 46                   struct list_head *prev,
 47                   struct list_head *next);
 48 #endif
 49
 50 /**
 51  * list_add - add a new entry
 52  * @new: new entry to be added
 53  * @head: list head to add it after
 54  *
 55  * Insert a new entry after the specified head.
 56  * This is good for implementing stacks.
 57  */
 58 static inline void list_add(struct list_head *new, struct list_head *head)
 59 {
 60     __list_add(new, head, head->next);
 61 }
 62
 63
 64 /**
 65  * list_add_tail - add a new entry
 66  * @new: new entry to be added
 67  * @head: list head to add it before
 68  *
 69  * Insert a new entry before the specified head.
 70  * This is useful for implementing queues.
 71  */
 72 static inline void list_add_tail(struct list_head *new, struct list_head *head)
 73 {
 74     __list_add(new, head->prev, head);
 75 }
 76
 77 /*
 78  * Delete a list entry by making the prev/next entries
 79  * point to each other.
 80  *
 81  * This is only for internal list manipulation where we know
 82  * the prev/next entries already!
 83  */
 84 static inline void __list_del(struct list_head * prev, struct list_head * next)
 85 {
 86     next->prev = prev;
 87     prev->next = next;
 88 }
 89
 90 /**
 91  * list_del - deletes entry from list.
 92  * @entry: the element to delete from the list.
 93  * Note: list_empty() on entry does not return true after this, the entry is
 94  * in an undefined state.
 95  */
 96 #ifndef CONFIG_DEBUG_LIST
 97 static inline void __list_del_entry(struct list_head *entry)
 98 {
 99     __list_del(entry->prev, entry->next);
100 }
101 #endif
102
103 /**
104  * list_replace - replace old entry by new one
105  * @old : the element to be replaced
106  * @new : the new element to insert
107  *
108  * If @old was empty, it will be overwritten.
109  */
110 static inline void list_replace(struct list_head *old,
111                 struct list_head *new)
112 {
113     new->next = old->next;
114     new->next->prev = new;
115     new->prev = old->prev;
116     new->prev->next = new;
117 }
118
119 static inline void list_replace_init(struct list_head *old,
120                     struct list_head *new)
121 {
122     list_replace(old, new);
123     INIT_LIST_HEAD(old);
124 }
125
126 /**
127  * list_del_init - deletes entry from list and reinitialize it.
128  * @entry: the element to delete from the list.
129  */
130 static inline void list_del_init(struct list_head *entry)
131 {
132     __list_del_entry(entry);
133     INIT_LIST_HEAD(entry);
134 }
135
136 /**
137  * list_move - delete from one list and add as another‘s head
138  * @list: the entry to move
139  * @head: the head that will precede our entry
140  */
141 static inline void list_move(struct list_head *list, struct list_head *head)
142 {
143     __list_del_entry(list);
144     list_add(list, head);
145 }
146
147 /**
148  * list_move_tail - delete from one list and add as another‘s tail
149  * @list: the entry to move
150  * @head: the head that will follow our entry
151  */
152 static inline void list_move_tail(struct list_head *list,
153                   struct list_head *head)
154 {
155     __list_del_entry(list);
156     list_add_tail(list, head);
157 }
158
159 /**
160  * list_is_last - tests whether @list is the last entry in list @head
161  * @list: the entry to test
162  * @head: the head of the list
163  */
164 static inline int list_is_last(const struct list_head *list,
165                 const struct list_head *head)
166 {
167     return list->next == head;
168 }
169
170 /**
171  * list_empty - tests whether a list is empty
172  * @head: the list to test.
173  */
174 static inline int list_empty(const struct list_head *head)
175 {
176     return head->next == head;
177 }
178
179 /**
180  * list_empty_careful - tests whether a list is empty and not being modified
181  * @head: the list to test
182  *
183  * Description:
184  * tests whether a list is empty _and_ checks that no other CPU might be
185  * in the process of modifying either member (next or prev)
186  *
187  * NOTE: using list_empty_careful() without synchronization
188  * can only be safe if the only activity that can happen
189  * to the list entry is list_del_init(). Eg. it cannot be used
190  * if another CPU could re-list_add() it.
191  */
192 static inline int list_empty_careful(const struct list_head *head)
193 {
194     struct list_head *next = head->next;
195     return (next == head) && (next == head->prev);
196 }
197
198 /**
199  * list_rotate_left - rotate the list to the left
200  * @head: the head of the list
201  */
202 static inline void list_rotate_left(struct list_head *head)
203 {
204     struct list_head *first;
205
206     if (!list_empty(head)) {
207         first = head->next;
208         list_move_tail(first, head);
209     }
210 }
211
212 /**
213  * list_is_singular - tests whether a list has just one entry.
214  * @head: the list to test.
215  */
216 static inline int list_is_singular(const struct list_head *head)
217 {
218     return !list_empty(head) && (head->next == head->prev);
219 }
220
221 static inline void __list_cut_position(struct list_head *list,
222         struct list_head *head, struct list_head *entry)
223 {
224     struct list_head *new_first = entry->next;
225     list->next = head->next;
226     list->next->prev = list;
227     list->prev = entry;
228     entry->next = list;
229     head->next = new_first;
230     new_first->prev = head;
231 }
232
233 /**
234  * list_cut_position - cut a list into two
235  * @list: a new list to add all removed entries
236  * @head: a list with entries
237  * @entry: an entry within head, could be the head itself
238  *    and if so we won‘t cut the list
239  *
240  * This helper moves the initial part of @head, up to and
241  * including @entry, from @head to @list. You should
242  * pass on @entry an element you know is on @head. @list
243  * should be an empty list or a list you do not care about
244  * losing its data.
245  *
246  */
247 static inline void list_cut_position(struct list_head *list,
248         struct list_head *head, struct list_head *entry)
249 {
250     if (list_empty(head))
251         return;
252     if (list_is_singular(head) &&
253         (head->next != entry && head != entry))
254         return;
255     if (entry == head)
256         INIT_LIST_HEAD(list);
257     else
258         __list_cut_position(list, head, entry);
259 }
260
261 static inline void __list_splice(const struct list_head *list,
262                  struct list_head *prev,
263                  struct list_head *next)
264 {
265     struct list_head *first = list->next;
266     struct list_head *last = list->prev;
267
268     first->prev = prev;
269     prev->next = first;
270
271     last->next = next;
272     next->prev = last;
273 }
274
275 /**
276  * list_splice - join two lists, this is designed for stacks
277  * @list: the new list to add.
278  * @head: the place to add it in the first list.
279  */
280 static inline void list_splice(const struct list_head *list,
281                 struct list_head *head)
282 {
283     if (!list_empty(list))
284         __list_splice(list, head, head->next);
285 }
286
287 /**
288  * list_splice_tail - join two lists, each list being a queue
289  * @list: the new list to add.
290  * @head: the place to add it in the first list.
291  */
292 static inline void list_splice_tail(struct list_head *list,
293                 struct list_head *head)
294 {
295     if (!list_empty(list))
296         __list_splice(list, head->prev, head);
297 }
298
299 /**
300  * list_splice_init - join two lists and reinitialise the emptied list.
301  * @list: the new list to add.
302  * @head: the place to add it in the first list.
303  *
304  * The list at @list is reinitialised
305  */
306 static inline void list_splice_init(struct list_head *list,
307                     struct list_head *head)
308 {
309     if (!list_empty(list)) {
310         __list_splice(list, head, head->next);
311         INIT_LIST_HEAD(list);
312     }
313 }
314
315 /**
316  * list_splice_tail_init - join two lists and reinitialise the emptied list
317  * @list: the new list to add.
318  * @head: the place to add it in the first list.
319  *
320  * Each of the lists is a queue.
321  * The list at @list is reinitialised
322  */
323 static inline void list_splice_tail_init(struct list_head *list,
324                      struct list_head *head)
325 {
326     if (!list_empty(list)) {
327         __list_splice(list, head->prev, head);
328         INIT_LIST_HEAD(list);
329     }
330 }
331
332 /**
333  * list_entry - get the struct for this entry
334  * @ptr:    the &struct list_head pointer.
335  * @type:    the type of the struct this is embedded in.
336  * @member:    the name of the list_struct within the struct.
337  */
338 #define list_entry(ptr, type, member) 339     container_of(ptr, type, member)
340
341 /**
342  * list_first_entry - get the first element from a list
343  * @ptr:    the list head to take the element from.
344  * @type:    the type of the struct this is embedded in.
345  * @member:    the name of the list_struct within the struct.
346  *
347  * Note, that list is expected to be not empty.
348  */
349 #define list_first_entry(ptr, type, member) 350     list_entry((ptr)->next, type, member)
351
352 /**
353  * list_for_each    -    iterate over a list
354  * @pos:    the &struct list_head to use as a loop cursor.
355  * @head:    the head for your list.
356  */
357 #define list_for_each(pos, head) 358     for (pos = (head)->next; pos != (head); pos = pos->next)
359
360 /**
361  * __list_for_each    -    iterate over a list
362  * @pos:    the &struct list_head to use as a loop cursor.
363  * @head:    the head for your list.
364  *
365  * This variant doesn‘t differ from list_for_each() any more.
366  * We don‘t do prefetching in either case.
367  */
368 #define __list_for_each(pos, head) 369     for (pos = (head)->next; pos != (head); pos = pos->next)
370
371 /**
372  * list_for_each_prev    -    iterate over a list backwards
373  * @pos:    the &struct list_head to use as a loop cursor.
374  * @head:    the head for your list.
375  */
376 #define list_for_each_prev(pos, head) 377     for (pos = (head)->prev; pos != (head); pos = pos->prev)
378
379 /**
380  * list_for_each_safe - iterate over a list safe against removal of list entry
381  * @pos:    the &struct list_head to use as a loop cursor.
382  * @n:        another &struct list_head to use as temporary storage
383  * @head:    the head for your list.
384  */
385 #define list_for_each_safe(pos, n, head) 386     for (pos = (head)->next, n = pos->next; pos != (head); 387         pos = n, n = pos->next)
388
389 /**
390  * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
391  * @pos:    the &struct list_head to use as a loop cursor.
392  * @n:        another &struct list_head to use as temporary storage
393  * @head:    the head for your list.
394  */
395 #define list_for_each_prev_safe(pos, n, head) 396     for (pos = (head)->prev, n = pos->prev; 397          pos != (head); 398          pos = n, n = pos->prev)
399
400 /**
401  * list_for_each_entry    -    iterate over list of given type
402  * @pos:    the type * to use as a loop cursor.
403  * @head:    the head for your list.
404  * @member:    the name of the list_struct within the struct.
405  */
406 #define list_for_each_entry(pos, head, member)                407     for (pos = list_entry((head)->next, typeof(*pos), member);    408          &pos->member != (head);     409          pos = list_entry(pos->member.next, typeof(*pos), member))
410
411 /**
412  * list_for_each_entry_reverse - iterate backwards over list of given type.
413  * @pos:    the type * to use as a loop cursor.
414  * @head:    the head for your list.
415  * @member:    the name of the list_struct within the struct.
416  */
417 #define list_for_each_entry_reverse(pos, head, member)            418     for (pos = list_entry((head)->prev, typeof(*pos), member);    419          &pos->member != (head);     420          pos = list_entry(pos->member.prev, typeof(*pos), member))
421
422 /**
423  * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
424  * @pos:    the type * to use as a start point
425  * @head:    the head of the list
426  * @member:    the name of the list_struct within the struct.
427  *
428  * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
429  */
430 #define list_prepare_entry(pos, head, member) 431     ((pos) ? : list_entry(head, typeof(*pos), member))
432
433 /**
434  * list_for_each_entry_continue - continue iteration over list of given type
435  * @pos:    the type * to use as a loop cursor.
436  * @head:    the head for your list.
437  * @member:    the name of the list_struct within the struct.
438  *
439  * Continue to iterate over list of given type, continuing after
440  * the current position.
441  */
442 #define list_for_each_entry_continue(pos, head, member)         443     for (pos = list_entry(pos->member.next, typeof(*pos), member);    444          &pos->member != (head);    445          pos = list_entry(pos->member.next, typeof(*pos), member))
446
447 /**
448  * list_for_each_entry_continue_reverse - iterate backwards from the given point
449  * @pos:    the type * to use as a loop cursor.
450  * @head:    the head for your list.
451  * @member:    the name of the list_struct within the struct.
452  *
453  * Start to iterate over list of given type backwards, continuing after
454  * the current position.
455  */
456 #define list_for_each_entry_continue_reverse(pos, head, member)        457     for (pos = list_entry(pos->member.prev, typeof(*pos), member);    458          &pos->member != (head);    459          pos = list_entry(pos->member.prev, typeof(*pos), member))
460
461 /**
462  * list_for_each_entry_from - iterate over list of given type from the current point
463  * @pos:    the type * to use as a loop cursor.
464  * @head:    the head for your list.
465  * @member:    the name of the list_struct within the struct.
466  *
467  * Iterate over list of given type, continuing from current position.
468  */
469 #define list_for_each_entry_from(pos, head, member)             470     for (; &pos->member != (head);    471          pos = list_entry(pos->member.next, typeof(*pos), member))
472
473 /**
474  * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
475  * @pos:    the type * to use as a loop cursor.
476  * @n:        another type * to use as temporary storage
477  * @head:    the head for your list.
478  * @member:    the name of the list_struct within the struct.
479  */
480 #define list_for_each_entry_safe(pos, n, head, member)            481     for (pos = list_entry((head)->next, typeof(*pos), member),    482         n = list_entry(pos->member.next, typeof(*pos), member);    483          &pos->member != (head);                     484          pos = n, n = list_entry(n->member.next, typeof(*n), member))
485
486 /**
487  * list_for_each_entry_safe_continue - continue list iteration safe against removal
488  * @pos:    the type * to use as a loop cursor.
489  * @n:        another type * to use as temporary storage
490  * @head:    the head for your list.
491  * @member:    the name of the list_struct within the struct.
492  *
493  * Iterate over list of given type, continuing after current point,
494  * safe against removal of list entry.
495  */
496 #define list_for_each_entry_safe_continue(pos, n, head, member)         497     for (pos = list_entry(pos->member.next, typeof(*pos), member),         498         n = list_entry(pos->member.next, typeof(*pos), member);        499          &pos->member != (head);                        500          pos = n, n = list_entry(n->member.next, typeof(*n), member))
501
502 /**
503  * list_for_each_entry_safe_from - iterate over list from current point safe against removal
504  * @pos:    the type * to use as a loop cursor.
505  * @n:        another type * to use as temporary storage
506  * @head:    the head for your list.
507  * @member:    the name of the list_struct within the struct.
508  *
509  * Iterate over list of given type from current point, safe against
510  * removal of list entry.
511  */
512 #define list_for_each_entry_safe_from(pos, n, head, member)             513     for (n = list_entry(pos->member.next, typeof(*pos), member);        514          &pos->member != (head);                        515          pos = n, n = list_entry(n->member.next, typeof(*n), member))
516
517 /**
518  * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
519  * @pos:    the type * to use as a loop cursor.
520  * @n:        another type * to use as temporary storage
521  * @head:    the head for your list.
522  * @member:    the name of the list_struct within the struct.
523  *
524  * Iterate backwards over list of given type, safe against removal
525  * of list entry.
526  */
527 #define list_for_each_entry_safe_reverse(pos, n, head, member)        528     for (pos = list_entry((head)->prev, typeof(*pos), member),    529         n = list_entry(pos->member.prev, typeof(*pos), member);    530          &pos->member != (head);                     531          pos = n, n = list_entry(n->member.prev, typeof(*n), member))
532
533 /**
534  * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
535  * @pos:    the loop cursor used in the list_for_each_entry_safe loop
536  * @n:        temporary storage used in list_for_each_entry_safe
537  * @member:    the name of the list_struct within the struct.
538  *
539  * list_safe_reset_next is not safe to use in general if the list may be
540  * modified concurrently (eg. the lock is dropped in the loop body). An
541  * exception to this is if the cursor element (pos) is pinned in the list,
542  * and list_safe_reset_next is called after re-taking the lock and before
543  * completing the current iteration of the loop body.
544  */
545 #define list_safe_reset_next(pos, n, member)                546     n = list_entry(pos->member.next, typeof(*pos), member)
547
548 /*
549  * Double linked lists with a single pointer list head.
550  * Mostly useful for hash tables where the two pointer list head is
551  * too wasteful.
552  * You lose the ability to access the tail in O(1).
553  */
554
555 #endif

list.h

测试用例:

 1 #include "list.h"
 2 #include <stdio.h>
 3 #include <stdlib.h>
 4
 5
 6 #define SZ 32
 7
 8 #define CNT 66
 9
10 struct ourstu {
11     char name[SZ];
12     int num;
13     struct list_head list;
14 };
15 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
16
17 #define container_of(ptr, type, member) ({            18     const typeof( ((type *)0)->member ) *__mptr = (ptr);    19     (type *)( (char *)__mptr - offsetof(type,member) );})
20
21
22
23 /*创建双向循环链表*/
24 LIST_HEAD(head);
25
26 static int demo_init(void)
27 {
28     int i;
29     struct ourstu *stu;
30
31     struct list_head *pos, *n;
32
33     for (i = 0; i < CNT; i++) {
34         stu = malloc(sizeof(struct ourstu));
35         if (NULL == stu) {
36             goto error0;
37         }
38         stu->num = 9527 + i;
39         sprintf(stu->name, "spring%d", i);
40
41         list_add_tail(&stu->list, &head);
42     }
43
44     list_for_each (pos, &head) {
45         stu = container_of(pos, struct ourstu, list);
46         printf("%s‘s number %d\n", stu->name, stu->num);
47     }
48
49
50     return 0;
51
52 error0:
53     list_for_each_safe(pos, n, &head) {
54         stu = container_of(pos, struct ourstu, list);
55         printf("%s see bye...\n", stu->name);
56         free(stu);
57     }
58
59     return -1;
60 }
61
62
63
64 static void demo_exit(void)
65 {
66     struct list_head *n, *pos;
67     struct ourstu *stu;
68
69     list_for_each_safe(pos, n, &head) {
70         stu = container_of(pos, struct ourstu, list);
71         printf("%s say bye...\n", stu->name);
72         free(stu);
73     }
74
75     printf("see you, kernel...\n");
76 }
77
78 int main()
79 {
80     demo_init();
81     demo_exit();
82 }

先学习到这,以后用到 list.h 中更多的再来补充。

原文地址:https://www.cnblogs.com/jason-linux/p/10465827.html

时间: 2024-11-06 11:25:48

学习/linux/list.h_双链表实现的相关文章

c++学习笔记_c++实现双链表

#include "stdafx.h"#include <iostream>#include <fstream>#include "conio.h"using namespace std; struct _DOUBLE_LINK_NODE  //定义一个双链表结构{    char * data;    struct _DOUBLE_LINK_NODE* prev; //双链表的前驱    struct _DOUBLE_LINK_NODE*

日常学习随笔-数组、单链表、双链表三种形式实现栈结构的基本操作

一.栈结构 栈(stack)是限制插入和删除只能在一个位置上的表,该位置是 表的末端,叫做栈的顶(Top).对栈的基本操作有push(进栈),pop(出栈),peak(栈顶元素),size(栈容量)等. 栈的核心思想:"先进后出". 二.案例一:数组实现"栈" 1 package com.xfwl.algorithmAnalysis.stack; 2 3 import java.util.Arrays; 4 5 /** 6 * 自定义栈结构(基于数组的形式) 7 *

数据结构学习之双链表基本操作

数据结构学习之双链表基本操作 0x1 前言 今天实验课,学习了下双链表的写法,这里记录下. 0x2 正文 题目要求如下: 本实验的双链链表元素的类型为char,完成如下实验要求: (1)初始化单链表h (2)采用尾插法依次插入a.b.c.d.e (3)输出单链表h (4)输出单链表h的长度 (5)判断单链表h是否为空 (6)输出单链表h的第3个元素 (7)输出元素a的逻辑位置 (8)在第4个元素位置上插入元素f (9)输出单链表h (10)删除单链表h的第3个元素 (11)输出单链表h (12)

Linux内核之数据双链表

导读 Linux 内核中自己实现了双向链表,可以在 include/linux/list.h 找到定义.我们将会首先从双向链表数据结构开始介绍内核里的数据结构.为什么?因为它在内核里使用的很广泛,你只需要在 free-electrons.com 检索一下就知道了. 首先让我们看一下在 include/linux/types.h 里的主结构体: struct list_head { struct list_head *next, *prev; }; 你可能注意到这和你以前见过的双向链表的实现方法是

小白该如何学习Linux操作系统(2)

献给初学者:小白该如何学习Linux操作系统(2) 三.用虚拟机软件学习linux 3.1 什么是虚拟机软件虚拟机软件能够在一台电脑上模仿出来若干台PC电脑,每台PC能够运转独自的操作系统而互不搅扰,能够完成一台电脑"一起"运转几个操作系统,还能够将这几个操作系统连成一个网络. 图1:安装了3台虚拟机的windows系统 比如图1中,是在一台电脑上安装了Windows 2000 Server,再在Win2000 server上安装虚拟机软件VMWare,利用VMWare模拟出来3台PC

写给准备学习Linux的人

现在国人学习linux的情况也是这样,学linux的人个个都意气分发,以为学习linux会用linux是多么了不得.学了一点皮裘就以为很牛了.但是那些企业用人单位却很难找到真实合适的linux人材.因而,我想就目前的情况宣布一下我的观点. 首先,这篇文章是写给那些想成为linux高手,并真正想用linux做些事情的人.如果你只想做一个菜鸟,没事的时候在你双系统启动的电脑上偶尔选一次 linux,然后没事进去偷着乐,那就请你自便.另外,我想说明,和真正的牛人比起来,我自己还处于一个比较低的水平.我

谈谈如何学习Linux操作系统

 献给初学者:为了能把这篇不错的文章分享给大家.所以请允许我暂时用原创的形式展现给大家. @hcy 更多资源:http://blog.sina.com.cn/iihcy 一. 选择适合自己的linux发行版谈到linux的发行版本,太多了,可能谁也不能给出一个准确的数字,但是有一点是可以肯定的,linux正在变得越来越流行, 面对这么多的Linux 发行版,打算从其他系统转到linux系统来的初学者可能会感到困惑,即便是忠实的 Linux 用户也没有时间和精力去挨个尝试,因此初学者在学习linu

初学者怎么学习Linux操作系统

一. 选择适合自己的linux发行版谈到linux的发行版本,太多了,可能谁也不能给出一个准确的数字,但是有一点是可以肯定的,linux正在变得越来越流行, 面对这么多的Linux 发行版,打算从其他系统转到linux系统来的初学者可能会感到困惑,即便是忠实的 Linux 用户也没有时间和精力去挨个尝试,因此初学者在学习linux的之前,需要有一个明确的方向,选择一个适合自己的系统开始学习linux至关重要!下面我们就分类介绍. 1.1 初学者入门首选-redhat系列在学习redhat系列li

你是如何学习 Linux 编程的?

首先,要学Linux编程,你得会用Linux,也就是得在命令行环境下生存下来.什么叫生存下来呢?就是我现在给你一台主机,键盘,显示器啥的,然后给你一个服务器版的Linux系统的光盘或者其他什么安装盘,你去把这台主机用起来.什么叫用起来呢?你平常用Windows电脑干啥,你现在还用这台电脑干啥.新建文件啊,查看文件,编辑文件,保存文件,复制,移动,删除,打包,解压,联网,下载个什么东西啊等等基本操作你得会.还有软件怎么安装,不仅要熟悉apt-get和yum,还有给你源码的软件怎么安装你得会,另外要