touch:
创建文件或者更新文件修改时间
[root@leitingyan ~]# touch 1.txt
[root@leitingyan ~]#
[root@leitingyan ~]# touch 1.txt
[root@leitingyan ~]# touch a.txt b.txt c.avi
cp:
复制文件或文件夹
//复制文件到指定目标
[root@leitingyan ~]# cp a.txt /root/Public/
[root@leitingyan ~]#
(2)如果复制的是文件夹,则需要添加参数 -r
[root@leitingyan ~]# cp -r Public Desktop/
(3) 如果赋值过程中有同名的文件则可以使用 -f进行强制覆盖
在linux中为什么加了-f但是没有效果
取消别名: \命令
mv:
(1)移动文件夹或文件
[root@leitingyan ~]# mv 1.txt Music/
[root@leitingyan ~]# mv Public Music/
(2)改名字
[root@leitingyan ~]# mv a.txt b.bcb
[root@leitingyan ~]# ls
anaconda-ks.cfg b.txt Desktop Downloads install.log.syslog Pictures Videos
b.bcb c.avi Documents install.log Music Templates
[root@leitingyan ~]#
rm:
删除文件或者文件夹
(1)删除文件
[root@leitingyan ~]# rm b.txt
rm: remove regular empty file `b.txt'? Y
(2) 删除文件夹
[root@leitingyan ~]# rm -r Music/
rm: descend into directory `Music'? y
rm: remove regular empty file `Music/1.txt'? Y
rm: descend into directory `Music/Public'? Y
rm: remove regular empty file `Music/Public/a.txt'? Y
rm: remove directory `Music/Public'? Y
rm: remove directory `Music'? Y
[root@leitingyan ~]# ls
anaconda-ks.cfg c.avi Documents install.log Pictures Videos
b.bcb Desktop Downloads install.log.syslog Templates
[root@leitingyan ~]#
(3)关掉提示警告:文件
[root@leitingyan ~]# rm -f c.avi
[root@leitingyan ~]# ^C
[root@leitingyan ~]# ls
anaconda-ks.cfg Desktop Downloads install.log.syslog Pictures Videos
b.bcb Documents install.log Music Templates
[root@leitingyan ~]#
(4) 删除文件夹时关掉提示
[root@leitingyan ~]# rm -rf Music/
[root@leitingyan ~]# ls
anaconda-ks.cfg b.bcb Desktop Documents Downloads install.log install.log.syslog Pictures Templates Videos
[root@leitingyan ~]#
cat:
查看文件内容
more:
也是查看,查看一大部分
[root@leitingyan ~]# more anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$UhaJsq1A.IxwFwZN$joqiwlFqQz0PzvYKjYCKMfawvd4PgyQJikvXjUPhZguknzXoe7CVtPOu3vE7j041Ae.m4BOvlF1.Ppt
h9oMyE/
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda
#part /boot --fstype=ext4 --size=500
#part pv.008002 --grow --size=1
#volgroup vg_leitingyan --pesize=4096 pv.008002
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_leitingyan --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=vg_leitingyan --grow --size=2048 --maxsize=2048
%packages
@base
@client-mgmt-tools
@core
@debugging
@basic-desktop
@desktop-debugging
less:
查看文件内容的一小部分
head:
从文件头开始查看
[root@leitingyan ~]# head anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$UhaJsq1A.IxwFwZN$joqiwlFqQz0PzvYKjYCKMfawvd4PgyQJikvXjUPhZguknzXoe7CVtPOu3vE7j041Ae.m4BOvlF1.Ppth9oMyE/
firewall --service=ssh
tail:
从文件的尾开始查看
[root@leitingyan ~]# tail anaconda-ks.cfg
genisoimage
device-mapper-persistent-data
abrt-gui
samba-winbind
certmonger
pam_krb5
krb5-workstation
libXmu
perl-DBD-SQLite
%end[root@leitingyan ~]#
grep:
筛选的意思
%end[root@leitingyan ~]# cat anaconda-ks.cfg | grep file
# Kickstart file automatically generated by anaconda.
@network-file-system-client
[root@leitingyan ~]#