linux xd命令,【Linux】常见基础命令之系统操作

linux现在基本上已成为面试的必考题目,特此总结一些常用的基础命令。

cd:切换目录

lilip@ubuntu:~$ cd /home/lilip/test

c7ce16de3f2afdad18636384f8d777ff.png

pwd:打印当前目录

lilip@ubuntu:~/test/page/inception$ pwd

2d0823797ebee61cb1ab2d606989cf85.png

ls:显示当前目录或指定目录下的文件和目录

lilip@ubuntu:~/test$ ls

7bf2f412f9fb3cf4940f23d870df6003.png

ll:以列表的形式显示目录下所有的文件和目录

lilip@ubuntu:~/test$ ll

07d742a7da7951d192d1bef68e3761e1.png

mkdir:创建新目录

lilip@ubuntu:~/test$ mkdir page

7e459e22b5eb4b3bb4c08f4d4bb10b47.png

rm:删除,可以删除目录和文件

lilip@ubuntu:~/test$ rm -rf page

0d653788c8a31c926fa977e70ce429cc.png

tar:打包/解包命令,打包可以是文件或者目录

打包:tar –czvf 新打包文件名.tar.gz 文件1/目录1 文件2/目录2

lilip@ubuntu:~/test/page$ tar -czvf test.tar.gz test.txt tar.txt

5a729afce4c98b9e8e6c1769c0162dc1.png

lilip@ubuntu:~$ tar -czvf test.tar.gz test/page/ test/inception/

3652146e104d5fd30cc8a0fc18530ea0.png

解包:tar –xzvf 解包文件名

lilip@ubuntu:~$ tar -xzvf test.tar.gz

e93b509545a344c76b16887d73f448bf.png

chmod:修改文件或目录的权限

格式:chmod [ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+

lilip@ubuntu:~/test$ chmod 777 myfile

292cf072898f19868cad6845702adbfd.png

权限说明:

600:只有所有者有读和写的权限

644:所有者有读和写的权限,组用户只有读的权限

700:只有所有者有读和写以及执行的权限

666:每个人都有读和写的权限

777:每个人都有读和写以及执行的权限

lilip@ubuntu:~/test/page$ chmod u+x test.txt

f1e5e7fd77cf7bdc0ea2608395841512.png

chmod的语法格式说明:chmod [who] [opt] [mode] 文件/目录名

who表示对象,是以下字母中的一个或组合:

u:表示文件所有者

g:表示同组用户

o:表示其它用户

a:表示所有用户

opt表示操作,可以为:

+:添加某个权限

-:取消某个权限

=:赋予给定的权限,并取消原有的权限

mode表示权限:

r:可读

w:可写

x:可执行

top:监视进程和Linux整体性能

lilip@ubuntu:~$ top

f7335d8e5d28131879f789f242860433.png

ps:查询进程

lilip@ubuntu:~/test/page$ ps

d3608903e2cd6583c507383586c509c5.png

lilip@ubuntu:~/test/page$ ps -ef|grep bash

查看包含bash的进程

9e936c7a33a479430c898f52fdd4a89b.png

netstat:查询进程端口号

root@ubuntu:~# netstat -anp|grep 30418

e0252fc284a4514ab008982705feaea4.png

kill:结束进程

kill 进程编号

lilip@ubuntu:~/test/page$ kill 63169

6f447070df0011d1da6d62c4ff78dc74.png

cp:拷贝

拷贝目录:

-r:若给出的源文件是一个目录文件,此时将复制该目录下所有的子目录和文件

【拷贝路径】

lilip@ubuntu:~/test$ cp -r inception/ page/

9e0b2b51a52a00d3d6bb8bd53d23995e.png

【拷贝文件】

lilip@ubuntu:~/test/page$ cp test.txt inception/

c6494497aeb05ebae970d415241b9c88.png

mv:移动文件/目录

【移动文件并重新命名】

lilip@ubuntu:~/test/page$ mv test.txt inception/mvtest.txt

66c15166da15de54053a5483835f739d.png

【移动目录】

lilip@ubuntu:~/test/page$ mv mvtest/ inception

008d80c19f62f649b320d17516ba89b1.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值