我的Linux初学笔记

来源:互联网 发布:网络与新媒体专业出国 编辑:程序博客网 时间:2024/05/16 09:35
The prompt(提示符) for the Bourne is $ or # for the root user

And the prompt for the C shell is % 


(三种shell:Bourne Shell、    C Shell、      Korn Shell)
        《sh》      《csh or tcsh》 《ksh》


sudo -sH 将自己提升为ROOT以便拥有最高权限


ls


ll    列表


mkdir 创建文件夹


cat file1 打开file1文件


cat >file1
(some text)
[Ctrl+D] 向file1里输入内容


cp 复制(copy)


mv 移动(move)


mv file1 hello 将file1重命名为hello


rm 删除(remove)// !注意!:在Linux下删除是永久的


rmdir 删除一个空目录


pwd 显示出当前目录(present working direcrory)


head -13 file1 显示file1的前13行


tail -13 file1 显示file1的最后13行


more file1 逐屏显示
(Read files and display the text ont screen at a time)


passwd 设置或者更改密码


ps 查看正在运行的进程


top 查看所有进程对CPU的使用情况


kill [-signal] [process id] 结束进程


kill 0 终止所有进程除了当前的“Terminal”


who 显示所有用户信息


who am i 显示当前用户信息


whoami 显示当前用户名


--------------------------------------------------------------------------


[Ctrl+S] Pause Display


[Ctrl+Q] Restart Display


[Ctrl+C] Cancel Operetion


[Ctrl+U] Cancel Line


[Ctrl+D] Signal the end of file


[Ctrl+V] Treat following character as normal character


--------------------------------------------------------------------------


sort file1 It prints the lines of file1 in sorted order


touch file2 创建一个空文件file2


cmd1|cmd2 管道(一个竖线)使得cmd1的运行结果作为cmd2的参数


alias -p cls=clear


read myVar 用户输入一个值,并赋给变量myVar


c=$((表达式)) 计算表达式的值并赋给c


echo $c 输出变量c的值(对变量的引用用符号$)


-------------------------------------------------------------------------
_
if 条件表达式 |
then 语句1 |
else if 条件表达式2 |
then 语句2 | if
... |
else |
语句3 |
fi |
~


_
while 条件表达式 |
do |
语句.. | while循环
break |
continue |
done |
~


_
for variable [ in list_of_values ] |
do | for循环
语句... |
done |
~
-------------------------------------------------------------------------


grep "public" file1.java
在file1.java中寻找含有“public”的行并高亮显示
grep -i 忽略大小写
     -n Display numbers
     -e Multiple patterns(grep -e "string1" -e "string2" file1.java)


zip filename.zip [ file1 file2 file3 ... ] or [ dir1 dir2 dir3 ... ]
压缩文件
unzip filename
解压文件(将所包含的文件或文件夹复制到当前目录)


tar -cf filename.tar [ file1 file2 file3 ... ] or [ dir1 dir2 dir3 ... ]
创建一个filename.tar,包含所有这些文件或者文件夹


tar -tvf filename.tar  显示filename.tar所包含的文件或文件夹


tar -xvf filename.tar  将filename.tar包含的所有文件或文件夹拷贝到当前路径


-------------------------------------------------------------------------


Editors:
   1.Textual editor
1.1 vi/vim (最常用)
1.2 emacs
1.3 pico
   2.Grapphical editor
2.1 gvim
2.2 emacs/xemacs
2.3 dtpad(CDE)
2.4 jot(SGI)
-------------------------------------------------------------------------


netstat 用来检查网络连接
如:netstat -rn








































原创粉丝点击