2023年7月26日发(作者:)
1. 文件和目录类命令
(1) 利用root用户登录,右击桌面,选择打开终端,进入字符提示界面
(2) 输入pwd
(3) 输入ls
(4) 输入ls –a
(5) 输入man ls //查看ls命令的使用手册,空格或P键翻页,b键回翻,q键退出
(6) 输入mkdir ./test //也可直接输入mkdir test或者输入mkdir /root/test
(7) 输入ls //查看test目录已经存在或者输入ll命令,使用长格式显示
(8) 输入cd ./test //也可直接输入cd test或者输入cd /root/test
(9) 输入touch newfile //也可输入touch ./newfile或者输入touch /root/test/newfile
(10) 输入cp /etc/profile . //也可输入cp /etc/profile /root/test
(11) 输入cp profile //也可以输入 cp ./profile ./
(12) 输入ll或者输入ls –l
(13) 输入less profile //按p键和空格键向下翻页,按b键向上翻页,按/后输入then关键字后按回车键,可以对then关键字查找
(14) 输入grep then profile
(15) 输入ln profile lnhprofile创建一个硬链接,输入ln –s profile lnsprofile创建一个软连接
(16) 输入ll,查看三个文件连接数的不同
(17) 输入rm profile,删除profile,再次输入ll查看lnsprofile和lnhprofile的详细信息,比较文件lnhprofile的连接数的变化
(18) 输入less lnsprofile
(19) 输入less lnhprofile
(20) 输入rm –f lnsprofile,不提示直接删除lnsprofile文件,查看输入ll,回到上一层目录输入cd ..
(21) 输入tar –cvf test //c表示创建压缩文件,v表示显示压缩的信息,f表示指定压缩文件名
(22) 输入gzip -v9 //对 进行压缩,比率是最高的9倍,改名后文件名有原来的变成了,并且文件的体积也变小了
(23) 输入mv
(24) 输入ls查看
(25) 输入mv ./test
(26) 输入ls查看
(27) 输入cd ./test进入test目录
(28) 输入tar -xzvf
(29) 输入ll显示信息,输入cp -R test testbak
(30) 输入find /root -name newfile
(31) 输入rm /root/test/test/*
(32) 输入rmdir /root/test/test或者输入rmdir ./test
(33) 输入cd ..回到上级目录,输入 rm –rf test不提示用户直接递归删除test下的所有文件和子目录。
2. 系统信息类命令
(1) 输入date显示当前系统的时间,输入date -s hh:mm:ss修改系统时间
和输入date -d mm/dd/yyyy修改系统日期
(2) 输入who
输入w
(3) 输入free
(4) 输入df -h
(5) 输入du /root查看/root目录的详细信息
输入du -s /root只查看/root目录的信息 3. 进程管理类命令
(1) 输入ps
输入ps -aux
输入cat &
输入ps或者ps –aux | grep cat
输入kill -9 [cat的进程号]
输入ps或者ps –aux | grep cat查看是否已经杀死cat进程
(2) 输入top
输入h显示帮助信息
输入C按照cpu占用率排列
输入M按照内存占用率排列
输入K可以杀死某个进程
输入U再输入用户名可以查看输入用户名的进程
输入Q可以退出top
(3) 输入cat
按下ctrl+z挂起cat
输入jobs,查看作业,cat已经停止
输入bg cat,让cat进程后台运行
输入fg cat,让cat进程切换到前台运行
按下ctrl+c,结束进程cat
(4) 输入find /var/lib -user games -exec ls –l {} ; 2> /dev/null
输入find /var -user root -exec ls -l {} ; 2> /dev/null
输入find / ! -user root -and ! -user bin -and ! -user student
> -exec ls -l {} ; 2> /dev/null
输入find /usr/bin -size +1000c -exec ls -l {} ; 2> /dev/null
输入find mp -user student -and -mmin +120 -and -type f
>-exec ls -l {} ; 2> /dev/null
4. rpm软件包的管理
(1) 输入rpm -qa | grep squid
(2) 我们的RHEL已经安装了squid,先卸载他,输入rpm –e squid
载入RHEL4的安装光盘,并输入命令挂载
输入mount /dev/cdrom /media进行挂载,输入ls /media查看是否已挂载
光盘中所有的rmp安装包在/media/RedHat/RPMS
安装squid软件包输入命令rpm -ivh /media/RedHat/RPMS/squid<按Tab补全>
输入rpm -ql squid查看软件包文件。 5. tar命令的使用
(1) 输入find /home -user student
>-exec tar -cvzf /tmp/ {} ; 2> /dev/null
(2) 输入tar -cvf /etc /tmp/
(3) 输入gzip -9 /tmp/
输入ll查看压缩前后的区别
发布者:admin,转转请注明出处:http://www.yc00.com/news/1690367055a339007.html
评论列表(0条)