返回列表 回复 发帖

[经验心得] [原创]自己写的linux 初级操作指南,请大家提些建议

相关搜索: linux, 指南, 建议, 初级
本帖最后由 bay__gulf618 于 2010-1-4 11:50 编辑

实验室需要一份初级使用指南,可以打印纸1页A4 纸上的。
下面是一个草稿,请大家看看还需要增加或删掉哪些

[ 本帖最后由 bay__gulf618 于 2009-3-14 20:18 编辑 ]
1

评分次数

  • homeboy

有偿处理数据,代写论文
站内信联系
0 说明
file 某文件
dir 某目录
cmd 某命令
~ 你的home目录
. 当前目录
.. 上级目

1 shell
shell是操作系统的界面,
bash的配置文件为~/.bashrc

2 获取帮助
cmd -h
cmd --help
man cmd (q 退出)
google & baidu

3 目录操作
a) ls 查看当前目录下的文件
ls dir
ls -l
ls -a
b) pwd 查看当前路径
c) cd 改变路径
cd dir

4 文件操作
a) cp 复制
cp file1 file2
cp file dir
cp -r dir1 dir2
b) mv 移动,重命名
mv file dir
mv dir1 dir2
mv file1 file2
mv file1 dir/file2
c) rm 删除
rm file
rm -rf dir

5 文本操作
cat file
more file
head -n # file
tail -n # file
grep "str" file

6 vi 编辑器
启动
vi
vi file
编辑 i
操作 ESC
命令 ESC :
w 写
x 退出保存
q! 退出不保存

7 任务
a) ps 查看当前任务
ps -aux
b) top 查看当前任务
按q 退出
c) cmd & 在后台执行
d) ctrl-z 把当前任务挂起
e) fg, bg 运行挂起的任务
f) ctrl-c 终止某任务
g) kill, pkill 强行终止某任务
h) cmd1;cmd2 连续运行多个任务

8) shell 操作
TAB 自动补齐
↑↓ 历史记录

9) 重定向
a) | 管道
cmd1 | cmd2
b) 输出重定向
cmd > file
cmd >> file
c) 输出重定向
cmd < file
d) tee 既显示又输入到文件
cmd | tee file

10) 其他
a) chmod 更改文件权限
b) dos2uinx 更改文本格式
c) exit 退出
有偿处理数据,代写论文
站内信联系
不错,很有用~
挺简单的,要他们作为一般用户使用也差不多够了,呵呵
谢谢楼主。
我也帖一下我的vi笔记吧,
供大家参考:
  1. [笔记整理]Vi简单用法
  2. 2009年02月26日 星期四 18:39
  3. Vi简单用法

  4. 本文系以前我学习vi的笔记的一点整理,仅供学习和参考之用,
  5. 未经许可,请勿转载。
  6.                                                                      ──realasking

  7. 1.vi编辑器的模式:

  8. 三种模式:命令模式,编辑模式,行编辑模式

  9. 模式切换:进入vi即进入了命令模式,切换到行编辑模式按冒号,
  10. 进入编辑模式按i键,从后两种模式退出到命令模式按Esc键

  11. 2.vi的启动,保存,放弃保存,放弃保存并退出:

  12. 启动:vi filename
  13. 即可打开一个文件进行编辑,如果filename不存在则新建filename

  14. 转到另一个文件:
  15. 假设为filename2,进入行编辑模式,执行:ex filename2

  16. 保存:需要进入行编辑模式,在任意模式下按Esc,然后输入":w"(
  17. 不包括引号)即可保存

  18. 退出:进入行编辑模式,然后按q键,即任意模式下按Esc,然后输入
  19. ":q"

  20. 保存并退出:":wq"

  21. 放弃保存并退出:":q!",其中"!"表示强制执行

  22. 放弃修改:":U",放弃所有的修改

  23. 3.光标控制:
  24. 大多需要在命令模式下执行。

  25. 光标的上下左右移动:现代的vi可以使用方向键完成,同时保留了传
  26. 统的设计,即k表示光标上移,j表示光标下移,h左移,l右移
  27. 不过在编辑模式下方向键仍然可以用来移动光标

  28. 光标按一定的分隔方式移动:
  29. (1)到文首: gg , 到文末:G
  30. (2)到屏幕头:H , 到屏幕中间: M ,到屏幕末尾:L
  31. (3)向前翻页(forward):Ctrl+f , 向后翻页(back):Ctrl+b
  32. (4)前翻半页:Ctrl+d , 后翻半页: Ctrl+u
  33. (5)光标移动到上一段开头:{,光标移动到下一段开头:}
  34. (6)光标移动到上一句开头:(,光标移动到下一句开头:)
  35. (7)光标到行首:0, 光标到行首第一个字符:^,光标到行末:$,全文:%
  36. (8)光标到下一个单词开头:w,光标到前一个单词开头:b

  37. 4.编辑操作:
  38. 均需要进入行编辑模式

  39. 块操作定义:
  40. 在插入块开始处按Ctrl+v,再把光标移到结束处就可以选定块,
  41. 需要注意的是块操作不是以行为单位进行选择的。

  42. 标记操作:
  43. 可以设置a~z个标记,标记操作的做法是mx,其中x为a~z中的一个,
  44. 标记的引用是:`x,x为a~z中的一个

  45. 操作结果放入寄存器:"寄存器名 操作,可以使用的寄存器名为英文字母和数字
  46. 如"ayy,即复制本行内容到寄存器a

  47. 行标的打开和关闭:
  48.    打开:set number 关闭:set nonumber

  49. 加密:
  50. 即:X

  51. 插入:
  52. (1)从光标处插入:i,然后进入编辑模式
  53. (2)从光标后插入:a,然后进入编辑模式

  54. 删除:
  55. 删除:d,默认是删除一行。
  56. 删除当前字符:x,命令模式下删除当前光标所在位置字符

  57. 查找:
  58. (1)查找文件中的字符串:/字符串
  59. (2)继续查找:/
  60. (3)继续查找(向后back):N

  61. 替换:s,默认是替换当前字符,一般和查找联合使用,
  62. 格式是:范围,次数s/查找内容/新内容/

  63. 移动:m

  64. 进入改写模式:R

  65. 撤销修改:u,撤销前一次的修改

  66. 5.复制,剪切和粘贴:

  67. 复制:y

  68. 粘贴:
  69. (1)光标前粘贴:p
  70. (2)光标后粘贴:P
  71. (3)粘贴到某行之后:t

  72. 6.命令的复合使用:
  73. 按:进入行编辑状态,然后按 次数,操作 的形式进行组合。
  74. 比如删除从光标起往前数5个单词,就是:5dw,往下面删除9行(含当前行)就是:9dj,
  75. 把光标所在处的字母替换成2个i,就是:2ri,复制5行就是:5yj,把第10行复制到第1行
  76. 之后:10t1,把文件第1行到第9行的a替换成b:1,9s/a/b/
  77. 另:调用系统命令:!命令 即可
复制代码
[ 本帖最后由 realasking 于 2009-3-15 10:59 编辑 ]
风雨三川吟游客,一剑西来巴子蛮
另外,个人看法的话,
关于chmod,cp和重定向,楼主似乎还可以再扩展一些内容,
这几个感觉还是满重要的。
还有就是tar命令打包和分卷打包,
因为在服务器上计算之后的话产生的文件会比较多,
而且体积都比较大,
打包便于下载,
所以我觉得这个似乎也可以谈谈。
风雨三川吟游客,一剑西来巴子蛮
那个vi 文档写的,要给实验室准备一份了。
我收藏过一个的.vimrc,是红旗带的,删除可以按backspace 和delete, 移动可以按方向键,非常好用。

tar 忘掉写了。
压缩解压
解压
tar zxvf file.tar.gz (or file.taz)
tar xvf file.tar
压缩
tar zcvf file.tar.gz  file (or dir/)


给文件加上可执行权限
chmod u+x file
只举个例子就可以了,否则就要从分组讲到权限再讲到8进制码。

重定向也太抽象了,我想举几个例子即可。毕竟我是想写给没有一点基础的初学者的。

[ 本帖最后由 bay__gulf618 于 2009-3-23 13:18 编辑 ]
附件: 您所在的用户组无法下载或查看附件,
1

评分次数

  • realasking

有偿处理数据,代写论文
站内信联系
ls 的那个附件第一个传错了,这是重发的。

刚刚看到一个namd编写组内部使用的写给初学者的unix指南,分享一下。
http://www.ks.uiuc.edu/Training/Tutorials/
Unix Primer - Basic Commands In the Unix Shell

If you have no experience with the Unix command shell, it will be best to work through this primer. The last section summarizes the basic file manipulation commands.

   1. Unix Shell

      The shell is a command programming language that provides an interface to the UNIX operating system. The remainder of this tutorial presents basic commands to use within the UNIX shell.
   2. Directories

      The shell should start you in your home directory. This is your individual space on the UNIX system for your files. You can find out the name of your current working directory by typing:

      % pwd
      /Users/username

      (The '%' designates your command line prompt, and you should type the letters 'p', 'w', 'd', and then "enter" - always conclude each command by pressing the "enter" key. The response that follows on the next line will be the name of your home directory, where the name following the last slash should be your username.) The directory structure can be conceptualized as an inverted tree.

      No matter where in the directory structure you are, you can always get back to your home directory by typing:

      % cd

      (without specifying a directory name).

      From your home directory, create a new subdirectory named "primer" for working through this tutorial:

      % mkdir primer

      You can remove an empty subdirectory with the following command (but don't do this right now):

      % rmdir primer

      (Note: if you do remove "primer", please create it again.)

      Now change to the "primer" subdirectory, making it your current working directory:

      % cd primer

   1. Files

      Files live within directories. You can see a list of the files in your "primer" directory (which should be your current working directory) by typing:

      % ls

      Since you just created the directory, nothing will be listed because the directory is empty. Create your first file using the pico text editor:

      % pico first

      The pico editor fills the entire console window. You can type text and move the cursor around with the arrow keys; the bottom of the screen presents the commands available. Type the sentence: "My first file." Then press "^O" (hold the left "control" key while pressing 'O') and "enter" to save the file, then "^X" (hold the left "control" key while pressing 'X') to exit pico. Now when you list your files, you will see file "first" listed:

      % ls
      first

      You can view a text file with the following command:

      % cat first
      My first file.

      ("cat" is short for concatenate - you can use this to display multiple files together on the screen.) If you have a file that is longer than your 24-line console window, use instead "more" to list one page at a time or "less" to scroll the file down and up with the arrow keys. Don't use these programs to try to display binary (non-text) files on your console - the attempt to print the non-printable control characters might alter your console settings and render the console unusable.

      Copy file "first" using the following command:

      % cp first 2nd

      By doing this you have created a new file named "2nd" which is a duplicate of file "first". The file listing reveals:

      % ls
      2nd     first

      Now rename the file "2nd" to "second":

      % mv 2nd second

      Listing the files still shows two files because you haven't created a new file, just changed an existing file's name:

      % ls
      first   second

      If you "cat" the second file, you'll see the same sentence as in your first file:

      % cat second
      My first file.

      "mv" will allow you to move files, not just rename them. Perform the following commands:

      % mkdir sub
      % mv second sub
      % ls sub
      second
      % ls
      first   sub

      This creates a new subdirectory named "sub", moves "second" into "sub", then lists the contents of both directories. You can list even more information about files by using the "-l" option with "ls":

      % ls -l
      -rw-r--r--   1 username     group         15 May 22 16:26 first
      drwxr-xr-x   2 username     group        512 May 22 17:11 sub

      (where "username" will be your username and "group" will be your group name). Among other things, this lists the creation date and time, file access permissions, and file size in bytes. The letter 'd' (the first character on the line) indicates the directory names.

      Next perform the following commands:

      % cd sub
      % pwd
      /Users/username/primer/sub
      % ls -l
      -rw-r--r--   1 username     group         15 May 22 16:55 second
      % cd ..
      % pwd
      /Users/username/primer

      This changes your current working directory to the "sub" subdirectory under "primer", lists the files there, then changes you back up a level. The ".." always refers to the parent directory of the given subdirectory.

      Finally, clean up the duplicate files by removing the "second" file and the "sub" subdirectory:

      % rm sub/second
      % rmdir sub
      % ls -l
      -rw-r--r--   1 username     group         15 May 22 16:26 first

      This shows that you can refer to a file in a different directory using the relative path name to the file (you can also use the absolute path name to the file - something like "/Users/username/primer/sub/second", depending on your home directory). You can also include the ".." within the path name (for instance, you could have referred to the file as "../primer/sub/second").
   2. Other Useful Commands

      The current date and time are printed with the following command:

      % date
      Thu May 22 17:39:04 CDT 2003

      Remote login to another machine can be accomplished using the "ssh" command:

      % ssh -l myname host

      where "myname" will be your username on the remote system (possibly identical to your username on this system) and "host" is the name (or IP address) of the machine you are logging into. Note that "ssh" is secure unlike older programs such as "telnet".

      Transfer files between machines using "scp". For example, to copy file "myfile" from the remote machine named "host", the command would be:

      % scp myname@host:myfile .

      (The "." refers to your current working directory, meaning that the destination for "myfile" is your current directory.)

      If you are running X11,  you should be able to start some applications from the command line, for example:

      % matlab &

      (The '&' character tells the console to run Matlab in the background - this way you immediately get a new prompt without first having to quit Matlab.)


      In OS X, you can open file using the command "open".  This command will open the file with the application corresponding to the file type. For example

      % open README.pdf

      will open the file README.pdf using Preview.  You can also open applications using the -a flag

      % open -a Safari

      or open a file using TextEdit with the -e flag

      % open -e mytext.txt

   1. Online Help

      You can get online help from the "man" pages ("man" is short for "manual"). The information is terse, but generally comprehensive, so it provides a nice reminder if you have forgotten the syntax of a particular command or need to know the full list of options.

      Use the "-k" option to provide a list of commands that pertain to a particular topic. For instance, try:

      % man -k "copy files"

      (and make sure to include the quotation marks). One of the commands listed should be the "cp" file copy command. Display the man page for "cp" by typing:

      % man cp

   2. Logging Out

      It is very important to log out of your account whenever you are done using it, especially if you are on a public machine.

      To close a shell window in a graphical environment, you can type:

      % exit

      Logging out from a graphical environment will require clicking on the appropriate icon. Logging out of a remote session can be done by either using the "exit" command or by typing:

      % logout

   3. Summary Of Basic Shell Commands
      % pico myfile         text edit file "myfile"
      % ls         list files in current directory
      % ls -l         long format listing
      % cat myfile         view contents of text file "myfile"
      % more myfile         paged viewing of text file "myfile"
      % less myfile         scroll through text file "myfile"
      % cp srcfile destfile         copy file "srcfile" to new file "destfile"
      % mv oldname newname         rename (or move) file "oldname" to "newname"
      % rm myfile         remove file "myfile"
      % mkdir subdir         make new directory "subdir"
      % cd subdir         change current working directory to "subdir"
      % rmdir subdir         remove (empty) directory "subdir"
      % pwd         display current working directory
      % date         display current date and time of day
      % ssh -l myname host         remote shell login of username "myname" to "host"
      % scp myname@host:myfile .         remote copy of file "myfile" to current directory
      % netscape &         start Netscape web browser (in background)
      % man -k "topic"         search manual pages for "topic"
      % man command         display man page for "command"
      % exit         exit a terminal window
      % logout         logout of a console session

[ 本帖最后由 bay__gulf618 于 2009-3-27 15:49 编辑 ]
1

评分次数

有偿处理数据,代写论文
站内信联系
再传一个vi的使用指南吧,也是ls 的地址。
这个排好版了可以打印在一页A4纸上。
附件: 您所在的用户组无法下载或查看附件,
1

评分次数

有偿处理数据,代写论文
站内信联系
感觉很有用,能省不少时间.我一着急就startkde,或者是gnome-session了.这样压缩解压缩,还有复制粘贴之类的就方便.其实主要还是win让我懒惰,笨拙了.
返回列表

本站属于学术,非经营性网站
本站所有资源均来自于互联网,所有个人文章和言论并不代表本站立场,如发现有侵权行为,请与我们联系,我们将在3个工作日内做出相应处理并给予答复