Download presentation
Presentation is loading. Please wait.
1
Confidential Property
Linux Shell 宋红包 4/14/2019 Confidential Property
2
Confidential Property
ls ls ls folder ls -a ls –l alias ll ll -R 4/14/2019 Confidential Property
3
Confidential Property
cd cd ~ pwd cd - cd .. 4/14/2019 Confidential Property
4
Confidential Property
cd mkdir -p /tmp/very/long/directory/structure/that/is/too/deep alias ..="cd .." alias ..2="cd ../.." alias ..3="cd ../../.." alias ..4="cd ../../../.." alias ..5="cd ../../../../.." 4/14/2019 Confidential Property
5
Confidential Property
cd '开启cd错误纠正' shopt -s cdspell file1 file2 folder1 folder2 '打错了目录名字,会自动纠错进入正确的目录' cd folderr1 folder1 4/14/2019 Confidential Property
6
Confidential Property
touch & mkdir mkdir folder mkdir my\ folder mkdir -p dir1/dir2/dir3/dir4/ touch file 4/14/2019 Confidential Property
7
Confidential Property
cp、mv、rm -r/-R/--recursive都代表递归的意思,大小写随便用 cp -r folder1 folder2 rm / alias rm alias rm='pwd;read;rm -i' 4/14/2019 Confidential Property
8
Confidential Property
tar -c:创建新的压缩文档,相当于打包。 -x:从文档中解压文件,相当于拆包。 -t:列出文档详细的内容,查看已经备份了哪些文件。 -z:用gzip压缩或解压,一般格式为.tar.gz或.tgz。 -j:用bzip2压缩或解压,一般格式为xx.tar.bz2,和gzip相比bzip2可以压缩的更小,但是执行过程更长。 -v :压缩的过程中显示文件。 -f :使用文档名,请留意,在f之后要立紧接文档名。 4/14/2019 Confidential Property
9
Confidential Property
tar '创建一个tar包' tar cvf archive_name.tar dirname/ '解压缩一个tar包' tar xvf archive_name.tar '查看tar包里面具体内容' tar tvf archive_name.tar 4/14/2019 Confidential Property
10
Confidential Property
zip & unzip yum install zip yum install unzip zip -r my.zip ./* unzip my.zip -d /tmp/ 4/14/2019 Confidential Property
11
Confidential Property
cat cat folder/info.php cat a.txt b.txt c.txt d.txt >> abcd.txt >>和>符号在linux中都代表重定向,它们可以将输出重定向到一个文件中。 >:如果文件存在,则会删除创建新文件。 >>:如果文件存在,不会触发删除,将会追加。 4/14/2019 Confidential Property
12
Confidential Property
grep I am Shy! Hello Shy! grep Hello file grep -i shy file grep -ic shy file grep -r 'h' * grep -i shy file | grep -v am 4/14/2019 Confidential Property
13
Confidential Property
find find path -options [-print -exec -ok …] path 为待查找的目录路径,options 为命令选项,它有很多命令参数。 print 将匹配的文件输出到标准输出,exec 对匹配的文件执行shell命令,ok 和exec的作用类似,它是一种更为安全的模式来执行shell命令,会给出提示让用户来确定是否执行。 4/14/2019 Confidential Property
14
Confidential Property
find find -name info.php find /etc/ -iname dir_* find / -name passwd -exec md5sum {} \; find ~ -empty find / -type f -name *.zip -size +1M -exec rm {} \; 4/14/2019 Confidential Property
15
Confidential Property
wget wget wget -O my.zip wget --limit-rate=20k wget -c 4/14/2019 Confidential Property
16
Confidential Property
yum & rpm yum install zip yum update zip yum remove zip yum search java rpm -ivh ***.rpm rpm -uvh ***.rpm rpm -ev ***.rpm 4/14/2019 Confidential Property
17
Confidential Property
date & cal date cal cal cal -j 4/14/2019 Confidential Property
18
Confidential Property
uname -a:详细输出所有信息 -m:主机的硬件(CPU)名 -n:主机在网络节点上的名称或主机名称 -r:操作系统内核版本号 -s:内核名称 -v:操作系统版本 -p:处理器类型 -i:硬件平台类型 -o:操作系统名 4/14/2019 Confidential Property
19
Confidential Property
The End 4/14/2019 Confidential Property
Similar presentations