Linux1

1、请用命令查出ifconfig命令程序的绝对路径

[root@localhost ~]# which ifconfig

/usr/sbin/ifconfig

2、请用命令展示以下命令哪些是内部命令,哪些是外部命令?(cd \ pwd \ ls \ ifconfig \ du)

[root@localhost ~]# type cd

cd shell 内嵌 (由此可见该命令cd为内部命令)

[root@localhost ~]# type pwd

pwd shell 内嵌 (由此可见该命令cd为内部命令)

[root@localhost ~]# type ls

ls `ls --color=auto' 的别名 (由此可见该命令cd部命令)

[root@localhost ~]# type ifconfig

ifconfig /usr/sbin/ifconfig  (由此可见该命令cd部命令)

[root@localhost ~]# type du

du /usr/bin/du   (由此可见该命令cd部命令)

3、请在/下创建目录abc

   请在/下创建目录/liangjian/liyunlong/weiheshang/duanpeng

   请在/abc下一次创建1000个目录,名字自己拟定。

[root@localhost ~]# cd /

[root@localhost /]# mkdir abc

[root@localhost /]# mkdir -pv /liangjian/liyunlong/weiheshang/duanpeng

mkdir: 已创建目录 "/liangjian"

mkdir: 已创建目录 "/liangjian/liyunlong"

mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang"

mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang/duanpeng"

[root@localhost /]# cd abc/

[root@localhost abc]# mkdir -pv {1..1000}e

[root@localhost abc]# ls

1000e  176e  251e  327e  402e  479e  554e  62e   705e  781e  857e  932e

100e   177e  252e  328e  403e  47e   555e  630e  706e  782e  858e  933e

101e   178e  253e  329e  404e  480e  556e  631e  707e  783e  859e  934e

102e   179e  254e  32e   405e  481e  557e  632e  708e  784e  85e   935e

103e   17e   255e  330e  406e  482e  558e  633e  709e  785e  860e  936e

104e   180e  256e  331e  407e  483e  559e  634e  70e   786e  861e  937e

105e   181e  257e  332e  408e  484e  55e   635e  710e  787e  862e  938e

106e   182e  258e  333e  409e  485e  560e  636e  711e  788e  863e  939e

107e   183e  259e  334e  40e   486e  561e  637e  712e  789e  864e  93e

108e   184e  25e   335e  410e  487e  562e  638e  713e  78e   865e  940e

109e   185e  260e  336e  411e  488e  563e  639e  714e  790e  866e  941e

10e    186e  261e  337e  412e  489e  564e  63e   715e  791e  867e  942e

110e   187e  262e  338e  413e  48e   565e  640e  716e  792e  868e  943e

111e   188e  263e  339e  414e  490e  566e  641e  717e  793e  869e  944e

112e   189e  264e  33e   415e  491e  567e  642e  718e  794e  86e   945e

113e   18e   265e  340e  416e  492e  568e  643e  719e  795e  870e  946e

114e   190e  266e  341e  417e  493e  569e  644e  71e   796e  871e  947e

115e   191e  267e  342e  418e  494e  56e   645e  720e  797e  872e  948e

116e   192e  268e  343e  419e  495e  570e  646e  721e  798e  873e  949e

117e   193e  269e  344e  41e   496e  571e  647e  722e  799e  874e  94e

118e   194e  26e   345e  420e  497e  572e  648e  723e  79e   875e  950e

119e   195e  270e  346e  421e  498e  573e  649e  724e  7e    876e  951e

11e    196e  271e  347e  422e  499e  574e  64e   725e  800e  877e  952e

120e   197e  272e  348e  423e  49e   575e  650e  726e  801e  878e  953e

121e   198e  273e  349e  424e  4e    576e  651e  727e  802e  879e  954e

122e   199e  274e  34e   425e  500e  577e  652e  728e  803e  87e   955e

123e   19e   275e  350e  426e  501e  578e  653e  729e  804e  880e  956e

124e   1e    276e  351e  427e  502e  579e  654e  72e   805e  881e  957e

125e   200e  277e  352e  428e  503e  57e   655e  730e  806e  882e  958e

126e   201e  278e  353e  429e  504e  580e  656e  731e  807e  883e  959e

127e   202e  279e  354e  42e   505e  581e  657e  732e  808e  884e  95e

128e   203e  27e   355e  430e  506e  582e  658e  733e  809e  885e  960e

129e   204e  280e  356e  431e  507e  583e  659e  734e  80e   886e  961e

12e    205e  281e  357e  432e  508e  584e  65e   735e  810e  887e  962e

130e   206e  282e  358e  433e  509e  585e  660e  736e  811e  888e  963e

131e   207e  283e  359e  434e  50e   586e  661e  737e  812e  889e  964e

132e   208e  284e  35e   435e  510e  587e  662e  738e  813e  88e   965e

133e   209e  285e  360e  436e  511e  588e  663e  739e  814e  890e  966e

134e   20e   286e  361e  437e  512e  589e  664e  73e   815e  891e  967e

135e   210e  287e  362e  438e  513e  58e   665e  740e  816e  892e  968e

136e   211e  288e  363e  439e  514e  590e  666e  741e  817e  893e  969e

137e   212e  289e  364e  43e   515e  591e  667e  742e  818e  894e  96e

138e   213e  28e   365e  440e  516e  592e  668e  743e  819e  895e  970e

139e   214e  290e  366e  441e  517e  593e  669e  744e  81e   896e  971e

13e    215e  291e  367e  442e  518e  594e  66e   745e  820e  897e  972e

140e   216e  292e  368e  443e  519e  595e  670e  746e  821e  898e  973e

141e   217e  293e  369e  444e  51e   596e  671e  747e  822e  899e  974e

142e   218e  294e  36e   445e  520e  597e  672e  748e  823e  89e   975e

143e   219e  295e  370e  446e  521e  598e  673e  749e  824e  8e    976e

144e   21e   296e  371e  447e  522e  599e  674e  74e   825e  900e  977e

145e   220e  297e  372e  448e  523e  59e   675e  750e  826e  901e  978e

146e   221e  298e  373e  449e  524e  5e    676e  751e  827e  902e  979e

147e   222e  299e  374e  44e   525e  600e  677e  752e  828e  903e  97e

148e   223e  29e   375e  450e  526e  601e  678e  753e  829e  904e  980e

149e   224e  2e    376e  451e  527e  602e  679e  754e  82e   905e  981e

14e    225e  300e  377e  452e  528e  603e  67e   755e  830e  906e  982e

150e   226e  301e  378e  453e  529e  604e  680e  756e  831e  907e  983e

151e   227e  302e  379e  454e  52e   605e  681e  757e  832e  908e  984e

152e   228e  303e  37e   455e  530e  606e  682e  758e  833e  909e  985e

153e   229e  304e  380e  456e  531e  607e  683e  759e  834e  90e   986e

154e   22e   305e  381e  457e  532e  608e  684e  75e   835e  910e  987e

155e   230e  306e  382e  458e  533e  609e  685e  760e  836e  911e  988e

156e   231e  307e  383e  459e  534e  60e   686e  761e  837e  912e  989e

157e   232e  308e  384e  45e   535e  610e  687e  762e  838e  913e  98e

158e   233e  309e  385e  460e  536e  611e  688e  763e  839e  914e  990e

159e   234e  30e   386e  461e  537e  612e  689e  764e  83e   915e  991e

15e    235e  310e  387e  462e  538e  613e  68e   765e  840e  916e  992e

160e   236e  311e  388e  463e  539e  614e  690e  766e  841e  917e  993e

161e   237e  312e  389e  464e  53e   615e  691e  767e  842e  918e  994e

162e   238e  313e  38e   465e  540e  616e  692e  768e  843e  919e  995e

163e   239e  314e  390e  466e  541e  617e  693e  769e  844e  91e   996e

164e   23e   315e  391e  467e  542e  618e  694e  76e   845e  920e  997e

165e   240e  316e  392e  468e  543e  619e  695e  770e  846e  921e  998e

166e   241e  317e  393e  469e  544e  61e   696e  771e  847e  922e  999e

167e   242e  318e  394e  46e   545e  620e  697e  772e  848e  923e  99e

168e   243e  319e  395e  470e  546e  621e  698e  773e  849e  924e  9e

169e   244e  31e   396e  471e  547e  622e  699e  774e  84e   925e

16e    245e  320e  397e  472e  548e  623e  69e   775e  850e  926e

170e   246e  321e  398e  473e  549e  624e  6e    776e  851e  927e

171e   247e  322e  399e  474e  54e   625e  700e  777e  852e  928e

172e   248e  323e  39e   475e  550e  626e  701e  778e  853e  929e

173e   249e  324e  3e    476e  551e  627e  702e  779e  854e  92e

174e   24e   325e  400e  477e  552e  628e  703e  77e   855e  930e

175e   250e  326e  401e  478e  553e  629e  704e  780e  856e  931e

 

4、请用绝对路径方式切换到/liangjian/liyunlong/weiheshang/duanpeng 目录下

并用pwd查看当前的路径,请用上级目录名".."方式切换到 /liangjian/liyunlong

[root@localhost /]# cd /liangjian/liyunlong/weiheshang/duanpeng

[root@localhost duanpeng]# pwd

/liangjian/liyunlong/weiheshang/duanpeng

[root@localhost duanpeng]# cd ../../

[root@localhost liyunlong]# pwd

/liangjian/liyunlong

 

5、请一次删除/abc下一次创建的1000个目录,请在/abc下用touch再创建20个以stu开头的普通可读文档,文档后缀为.txt

[root@localhost ~]# cd /

[root@localhost /]# ls

abc  boot  etc   liangjian  lib64  mnt  proc  run   srv  tmp  var

bin  dev   home  lib        media  opt  root  sbin  sys  usr

[root@localhost /]# cd abc

[root@localhost abc]# rm -rf *e

[root@localhost abc]# ls

[root@localhost abc]# touch stu{1..20}.txt

[root@localhost abc]# ls

stu10.txt  stu13.txt  stu16.txt  stu19.txt  stu2.txt  stu5.txt  stu8.txt

stu11.txt  stu14.txt  stu17.txt  stu1.txt   stu3.txt  stu6.txt  stu9.txt

stu12.txt  stu15.txt  stu18.txt  stu20.txt  stu4.txt  stu7.txt

6、请用cp命令将/boot/目录下以vmlinuz开头的文件拷贝到/abc下,并以查看他们占磁盘的空间大小。

[root@localhost abc]# cd

[root@localhost ~]# cd /boot/

[root@localhost boot]# ls

config-3.10.0-693.el7.x86_64

efi

grub

grub2

initramfs-0-rescue-652859c8f067410fb3f6cb55a2002985.img

initramfs-3.10.0-693.el7.x86_64.img

initramfs-3.10.0-693.el7.x86_64kdump.img

initrd-plymouth.img

symvers-3.10.0-693.el7.x86_64.gz

System.map-3.10.0-693.el7.x86_64

vmlinuz-0-rescue-652859c8f067410fb3f6cb55a2002985

vmlinuz-3.10.0-693.el7.x86_64

[root@localhost boot]# cp vm* /abc

[root@localhost boot]# cd

[root@localhost ~]# cd /abc

[root@localhost abc]# ls

stu10.txt  stu18.txt  stu6.txt

stu11.txt  stu19.txt  stu7.txt

stu12.txt  stu1.txt   stu8.txt

stu13.txt  stu20.txt  stu9.txt

stu14.txt  stu2.txt   vmlinuz-0-rescue-652859c8f067410fb3f6cb55a2002985

stu15.txt  stu3.txt   vmlinuz-3.10.0-693.el7.x86_64

stu16.txt  stu4.txt

stu17.txt  stu5.txt

[root@localhost abc]# du -sh vm*

5.7M vmlinuz-0-rescue-652859c8f067410fb3f6cb55a2002985

5.7M vmlinuz-3.10.0-693.el7.x86_64

7、将其中一个vmlinuz开头的文件改名为kgc,另外一个剪切到/tmp目录下。

[root@localhost abc]# mv vmlinuz-0-rescue-652859c8f067410fb3f6cb55a2002985 kgc

[root@localhost abc]# ls

kgc        stu14.txt  stu19.txt  stu4.txt  stu9.txt

stu10.txt  stu15.txt  stu1.txt   stu5.txt  vmlinuz-3.10.0-693.el7.x86_64

stu11.txt  stu16.txt  stu20.txt  stu6.txt

stu12.txt  stu17.txt  stu2.txt   stu7.txt

stu13.txt  stu18.txt  stu3.txt   stu8.txt

[root@localhost abc]# mv vmlinuz-3.10.0-693.el7.x86_64 /tmp

[root@localhost abc]# cd

[root@localhost ~]# ls /tmp

anaconda.log

hsperfdata_root

ifcfg.log

ks-script-i65dQj

packaging.log

program.log

sensitive-info.log

ssh-HMTUFpyXaglS

ssh-iGmfTDqoGBia

ssh-nAufw3euGxrg

ssh-OSOygLCPuVRT

ssh-pwDuJjMfKoFL

storage.log

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-chronyd.service-Fsk05z

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-colord.service-QUQiEg

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-cups.service-NH45Vq

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-rtkit-daemon.service-063LDo

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-vgauthd.service-yU963M

systemd-private-0dfdc136303a4adaa516b4d5ba9afec2-vmtoolsd.service-6szqvb

systemd-private-62b7fbf4dfc748119d5ce871106f7740-chronyd.service-k4esFF

systemd-private-62b7fbf4dfc748119d5ce871106f7740-colord.service-S0V0qv

systemd-private-62b7fbf4dfc748119d5ce871106f7740-cups.service-pJUz5h

systemd-private-62b7fbf4dfc748119d5ce871106f7740-rtkit-daemon.service-ATNRkP

systemd-private-62b7fbf4dfc748119d5ce871106f7740-vgauthd.service-e8eKu6

systemd-private-62b7fbf4dfc748119d5ce871106f7740-vmtoolsd.service-Axn1Un

systemd-private-73c510d8802d493e93b5b35fb2d11b82-chronyd.service-ZLtyI9

systemd-private-73c510d8802d493e93b5b35fb2d11b82-colord.service-tqEBBJ

systemd-private-73c510d8802d493e93b5b35fb2d11b82-cups.service-KxDISk

systemd-private-73c510d8802d493e93b5b35fb2d11b82-rtkit-daemon.service-mKN03S

systemd-private-73c510d8802d493e93b5b35fb2d11b82-vgauthd.service-x986Bq

systemd-private-73c510d8802d493e93b5b35fb2d11b82-vmtoolsd.service-SDmaQH

systemd-private-9cea467d2884469b90c511f46a0bc0db-chronyd.service-gWs8cm

systemd-private-9cea467d2884469b90c511f46a0bc0db-colord.service-g5DndK

systemd-private-9cea467d2884469b90c511f46a0bc0db-cups.service-d3nish

systemd-private-9cea467d2884469b90c511f46a0bc0db-rtkit-daemon.service-PBWY54

systemd-private-9cea467d2884469b90c511f46a0bc0db-vgauthd.service-8kicNO

systemd-private-9cea467d2884469b90c511f46a0bc0db-vmtoolsd.service-nnSLfE

systemd-private-e29cb3a5df254b62b4d66928738ba031-chronyd.service-lBb1UP

systemd-private-e29cb3a5df254b62b4d66928738ba031-colord.service-9BXiFe

systemd-private-e29cb3a5df254b62b4d66928738ba031-cups.service-b0MwTu

systemd-private-e29cb3a5df254b62b4d66928738ba031-rtkit-daemon.service-lpHe8X

systemd-private-e29cb3a5df254b62b4d66928738ba031-vgauthd.service-6F1ZUf

systemd-private-e29cb3a5df254b62b4d66928738ba031-vmtoolsd.service-2txyJx

tracker-extract-files.0

vmlinuz-3.10.0-693.el7.x86_64

VMwareDnD

yum.log

yum_save_tx.2019-07-20.13-50.3izI5K.yumtx

yum_save_tx.2019-07-22.09-38.Ufkl5W.yumtx

 

8、查看/tmp/目录下以vmlinuz开头文件的详细状态信息。

[root@localhost ~]# cd /tmp

[root@localhost tmp]# stat vmlinuz-3.10.0-693.el7.x86_64 

  文件:"vmlinuz-3.10.0-693.el7.x86_64"

  大小:5877760    块:11480      IO 块:4096   普通文件

设备:fd00h/64768d Inode68600796    硬链接:1

权限:(0755/-rwxr-xr-x)  Uid(    0/    root)   Gid(    0/    root)

最近访问:2019-07-24 09:18:45.973867362 +0800

最近更改:2019-07-24 09:18:45.983867385 +0800

最近改动:2019-07-24 09:22:48.135407831 +0800

创建时间:-

9、用find命令查找/tmp目录下以vmlinuz开头及大小超过1M的文件

[root@localhost ~]# find /tmp -size +1M -a -name "vmlinuz*"

/tmp/vmlinuz-3.10.0-693.el7.x86_64

 

posted @ 2019-07-24 09:58  elin菻  阅读(742)  评论(0编辑  收藏  举报