美文网首页
Linux实用命令

Linux实用命令

作者: 刘昊2018 | 来源:发表于2018-04-09 16:00 被阅读39次

Linux实用命令

前面已经说过,我们学习Linux,最基础的就是要掌握Linux实用命令的使用,这对提高我们的生产力有非常大的帮助,这篇文章主要记录学习Linux命令的过程。

帮助命令

man ls
help cd

man,help主要在我们不熟悉该命令用法的时候使用,可以查看该命令的使用帮助。

文件目录

pwd     //当前所在目录的绝对路径
ls -al  //当前目录下的所有子目录及文件并格式化显示
cd /root/temp //切换到root目录下的temp目录

cd ..        //切换到上一级目录
cd ~         // 切换到家目录 ,root用户为/root,其他用户为/home/username
mkdir temp  //在当前目录下创建temp文件夹
mkdir -p temp/newtemp //   -p 创建多级目录

rmdir temp // 删除目录 temp文件夹为空时使用
touch test.txt   // 创建名为test.txt的文件
cp source dest  // 拷贝文件

cp -r source dest  // 拷贝文件夹
rm test.txt  // 删除文件

rm -rf   temp   //强制删除包含内容的文件夹
mv source target //移动或重命名文件或文件夹
cat test.txt  // 查看文件内容
echo hello > hello.txt   创建hello.txt,写入hello字符串
ln -s source target  // 软链接  类似windows快捷方式
history   // 执行过的历史命令

搜索查找

find / -name test.txt
find / -user  root
find / -size +20M
//在指定目录下根据文件名,文件创建者,文件大小搜索文件
updatedb
locate test.txt
// 快速查找,基于数据库查询

以上。

相关文章

网友评论

      本文标题:Linux实用命令

      本文链接:https://www.haomeiwen.com/subject/qeeihftx.html