linux基础命令学习

欢迎大家来查看 这个可以保存手机哈 有什么写的不对的请大家 留言哈
感谢 linux命令冲查看开始了哈
ls 英文(list files)
用于显示指定工作目录之下的内容
列出目录 文件等等

命令格式 ls [选项] [操作对象]
例如:查看当前路径的文件目录等 ------------- ls 回车 会打印当前路径下的 文件和目录

[root@bogon ~]# ls
anaconda-ks.cfg       公共  视频  文档  音乐
initial-setup-ks.cfg  模板  图片  下载  桌面

[root@bogon ~]# ls -a
.                .bashrc    .ICEauthority         .Xauthority  下载
..               .cache     initial-setup-ks.cfg  公共         音乐
anaconda-ks.cfg  .config    .local                模板         桌面
.bash_history    .cshrc     .tcshrc               视频
.bash_logout     .dbus      .viminfo              图片
.bash_profile    .esd_auth  .vimrc                文档

[root@bogon ~]# ls -l
总用量 8
-rw-------. 1 root root 1833 25 17:07 anaconda-ks.cfg
-rw-r--r--. 1 root root 1881 25 17:10 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 25 17:12 公共
drwxr-xr-x. 2 root root    6 25 17:12 模板
drwxr-xr-x. 2 root root    6 25 17:12 视频
drwxr-xr-x. 2 root root    6 25 17:12 图片
drwxr-xr-x. 2 root root    6 25 17:12 文档
drwxr-xr-x. 2 root root    6 25 17:12 下载
drwxr-xr-x. 2 root root    6 25 17:12 音乐
drwxr-xr-x. 2 root root    6 25 17:12 桌面
选项Value
-a显示所有目录及文件(包括隐藏文件 以.开始的文件)
-l显示文件的全部信息
-h以人类易读的形式展示文件大小

查看文档类的命令
命令:cat、more、head、less、tail、
cat 英文(concatenatle)用于查看文档并打印在屏幕上, 还可以创建 文件, 追加内容

命令格式    cat [选项] [文件]
小技巧:创建一个文件:cat>test.txt <<EOF 
只能创建没有这个文件test.txt时创建 然后追加信息可以写入多行
EOF (end of file) 表示文本结束

实例:

创建文件并添加内容实例
[root@bogon ~]# cat >test.txt <<EOF   ## 创建test.txt文件并追加2行内容 123 qwe 然后 EOF结尾表示添加内容结束
> 123                                 ##内容 123
> qwe                                 ##内容 qwe
> EOF                                 ##结束 

[root@bogon ~]# cat test.txt        ##查看刚才添加内容
123
qwe


#还能这样用
[root@server ~]# cat << EOF > 1.txt
> 123
> qweqweqdasasdadfg34r2311
> dasdnihao
> EOF
[root@server ~]# cat 1.txt
123
qweqweqdasasdadfg34r2311
dasdnihao

当然这个 EOF 可以随意替换成自己喜欢的 但是开始是什么结尾就是用什么
选项

选项Value
-n显示行号的输出出来
-b对空行进行不编号
查看文档 more
	more类似cat 命令不过会以以一页一页的形式显示,
	空格键(space)就往下一页显示,
	b键就会往回一页显示,还有搜索字符串的功能
[root@bogon ~]# more /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and
the
# update status of each mirror to pick mirrors that are updated to a
nd
# geographically close to the client.  You should use this for CentO
S updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can t
ry the
# remarked out baseurl= line instead.

head 命令用于显示文件的开头内容。
在默认情况下head命令只显示前10行内容
语法格式:head 选项 文件

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值