@Sarah
2016-01-23T21:31:48.000000Z
字数 1535
阅读 1104
man ls
cd tutor
cd var
cd/var
cs..
cd . //change directory
cd ~ //直接return 到Home
mkdir //make directory
ls -l//列出文件
rmdir // 移除文件
cd// change directory
. > //out put overitting
. >> //open
. < //
cat > filename //create a new file
input the content
control+D //回到command
cat filename// 显示这个文件里的内容
touch sample2//
cp sample sample2 //把前面的复制到后面的文件里
cat sample2
cp -l sample sample2
cp: overwrite'sample2'? n
cat sample3
cp -l sample sample3
cp: overwrite'sample2'? y
cat sample3 //
man cp
mv // 原来的文件会被删除
mv sample sample3//把sample 的内容移动到smple3然后删除sample1的内容
rm sample2//删除文件
cd..
ls -l
//显示的几列 1u:谁写的 2g:group 3o:其他用户
w:write r:read
chmod u+x test
ls -l
chomd u-x test
ls -l
777 // user 有所有的权限都可以read write
r-4
x-1
w-2
每一个数字都代表权限
666
002
- -
664
umask 022
umask 002
2>
cat sample > sample
ls |wc -l
|val|log|syslog
more |val|log|syslog
less |val|log|syslog
tail /var/log/syslog
head -15 /var/log/syslog // 显示前15
more /var/log/syslog
wc * //what is the size of your file,how many words,what is the name
wc -l
wc -w test// how many words
wc -c //
wc -c test
echo "hello" //print
双引号:会被当成特殊符号
echo $hello
echo '$hello'
echo 'expr 3 + 4'
^abc //在行开始找abc
abc$ //在行末找abc
abc* //以abc开头
abc+ //要找的比abc多
[] //range
c[aut]y // check cay/cuy/cty
grep//搜索
grep ^d testfile //找以d开头的line
grep d$ testfile //找line以d结尾
gerp a+ testfile// 找比a多的
sort sorting //排序
sed 's/e/ee/' testfile //把e替换成ee
sed 's/h/hh/g' testfile //所有的h都替换成hh
sed '2d' testfile //the second line
sed '1,3d' testfile
ls -l | awk '{print s1,s2}'
qwk -F :'{print s1,"home:",s2}' etc/pas swd
vl scriptfile
ls
vl scriptfile
按i才能继续Inserting
:wq //存储退出
:q!不存储退出
按delete 会删除整个行
O //增加新行
/f 回车 //搜索(要先推出Insert mode)
i insert
:wq save&exit
:q exit without save
dd delete line
o,O insert
/a 回车 search
x delete characters
n next occurance