语法:cd <文件目录>
node
[root@localhost Desktop]# cd /home/ [root@localhost home]#
[root@localhost home]# pwd /home
[root@localhost home]# ls manniu
由于ls用的比较多,对应参数git
-a :所有的档案,连同隐藏档( 开头为 . 的档案) 一块儿列出来~
-A :所有的档案,连同隐藏档,但不包括 . 与 .. 这两个目录,一块儿列出来~
-d :仅列出目录自己,而不是列出目录内的档案数据
-f :直接列出结果,而不进行排序 (ls 预设会以档名排序!)
-F :根据档案、目录等信息,给予附加数据结构,例如:
*:表明可执行档; /:表明目录; =:表明 socket 档案; |:表明 FIFO 档案;
-h :将档案容量以人类较易读的方式(例如 GB, KB 等等)列出来;
-i :列出 inode 位置,而非列出档案属性;
-l :长数据串行出,包含档案的属性等等数据;
-n :列出 UID 与 GID 而非使用者与群组的名称 (UID与GID会在帐号管理提到!)
-r :将排序结果反向输出,例如:本来档名由小到大,反向则为由大到小;
-R :连同子目录内容一块儿列出来;
-S :以档案容量大小排序!
-t :依时间排序
--color=never :不要依据档案特性给予颜色显示;
--color=always :显示颜色
--color=auto :让系统自行依据设定来判断是否给予颜色
--full-time :以完整时间模式 (包含年、月、日、时、分) 输出
--time={atime,ctime} :输出 access 时间或 改变权限属性时间 (ctime)
redis
mkdir<参数> <文件名>
shell
[root@localhost home]# mkdir test [root@localhost home]# ls manniu test [root@localhost home]# mkdir test1/one mkdir: cannot create directory ‘test1/one’: No such file or directory [root@localhost home]# mkdir -p test1/one [root@localhost home]# ls manniu test test1
rmdir<参数> <文件名>数据结构
[root@localhost home]# rmdir test1/one/ [root@localhost home]# ls manniu test1 [root@localhost home]# mkdir test1/two [root@localhost home]# ls test1/ two [root@localhost home]# rmdir -p test1/two/ [root@localhost home]# ls manniu
cp <被复制文档> <目标文档>socket
[root@localhost home]# cp /software/redis-3.0.5.tar.gz /home/ [root@localhost home]# ls manniu redis-3.0.5.tar.gz [root@localhost home]# cp -r /software/redis-3.0.5/ /home/ [root@localhost home]# ls manniu redis-3.0.5 redis-3.0.5.tar.gz [root@localhost home]# cp /software/redis-3.0.5/ /home/ cp: omitting directory ‘/software/redis-3.0.5/’
从其余目录下面复制文件过来,cp其实不少参数。用的时候再说吧,我通常用的最多的就是-r,其实就是相似于window里面复制文件,复制文件夹。spa
rm <参数> <文件或目录>code
不加参数,删除文件。-r目录的删除,-f强制删除。(我常常用的~.~)
排序
[root@localhost home]# ls manniu redis-3.0.5 redis-3.0.5.tar.gz [root@localhost home]# rm -r redis-3.0.5 rm: descend into directory ‘redis-3.0.5’? y rm: remove regular file ‘redis-3.0.5/.gitignore’? ^Z [2]+ Stopped [root@localhost home]# rm -rf redis-3.0.5 [root@localhost home]# ls manniu redis-3.0.5.tar.gz [root@localhost home]# rm redis-3.0.5.tar.gz rm: remove regular file ‘redis-3.0.5.tar.gz’? y
mv <参数> <被移动文件> <目标目录>
rem
参数:
-f :force 强制的意思,强制直接移动而不询问;
-i :若目标档案 (destination) 已经存在时,就会询问是否覆盖!
-u :若目标档案已经存在,且 source 比较新,才会更新 (update)
[root@localhost home]# ls manniu [root@localhost home]# mkdir test [root@localhost home]# mkdir test1 [root@localhost home]# ls manniu test test1 [root@localhost home]# mv test test1/ [root@localhost home]# ls manniu test1 [root@localhost home]# ls test1/ test
which<文件名><-a参数>
通常的which只找出一个结果,加上参数-a,同名的结果也会被列出来。
[root@localhost home]# which mongod /usr/bin/mongod [root@localhost home]# which mongod -a /usr/bin/mongod /bin/mongod
whereis(寻找特定档案)
whereis <参数> <文件名字>
-b :只找 binary 的档案
-m :只找在说明文件 manual 路径下的档案
-s :只找 source 来源档案
-u :没有说明档的档案!
[root@localhost home]# whereis mongod mongod: /usr/bin/mongod /etc/mongod.conf /usr/share/man/man1/mongod.1 [root@localhost home]# whereis -m mongod mongod: /usr/share/man/man1/mongod.1
find
find [PATH] [option] [action]
下面这个是根据文件的名字来进行寻找,由于find是直接操做硬盘的,我表示在虚拟机上慢的很。这仅仅是-name一个参数,由于我通常也就用这个,其余还有不少参数。仍是用的时候再加上来
[root@localhost home]# find / -name mongod find: ‘/run/user/1000/gvfs’: Permission denied /run/lock/subsys/mongod /etc/sysconfig/mongod /etc/rc.d/init.d/mongod /usr/bin/mongod