Touch, Cat
Touch, Cat
it is use to create empty files , you can also create multiple files.
and it is also use to change the time stamp of files and directories
syntax:
options:
eg:
/root
[root@localhost ~]# ls
[root@localhost ~]# ls
anaconda-ks.cfg Documents initial-setup-ks.cfg Pictures Templates test1.txt text2.txt
[root@localhost ~]# ls
[root@localhost ~]# cd /
[root@localhost /]# ls
bin dev file2.txt lib media opt root sbin sys usr
boot etc home lib64 mnt proc run srv tmp var
[root@localhost /]# cd
[root@localhost ~]# ls /
bin dev file2.txt lib media opt root sbin sys usr
boot etc home lib64 mnt proc run srv tmp var
file2.txt
systemd-private-b2133f7679e1412da15d36e37f3d9653-bluetooth.service-aN1b4t
systemd-private-b2133f7679e1412da15d36e37f3d9653-colord.service-A6eg9E
systemd-private-b2133f7679e1412da15d36e37f3d9653-fwupd.service-LxZ1LE
systemd-private-b2133f7679e1412da15d36e37f3d9653-geoclue.service-GZmpsk
systemd-private-b2133f7679e1412da15d36e37f3d9653-ModemManager.service-d5hX8v
systemd-private-b2133f7679e1412da15d36e37f3d9653-rtkit-daemon.service-OkQvLy
[root@localhost ~]# touch apple{1..5}.txt
[root@localhost ~]# ls
[root@localhost ~]# ls
[root@localhost ~]# ls
[root@localhost ~]# ls
[root@localhost ~]# ls
[root@localhost ~]# ls
File: sample.txt
Context: unconfined_u:object_r:admin_home_t:s0
Birth: -
[root@localhost ~]# ls
Context: unconfined_u:object_r:admin_home_t:s0
Birth: -
File: mydata.txt
Context: unconfined_u:object_r:admin_home_t:s0
Birth: -
File: mydata.txt
Context: unconfined_u:object_r:admin_home_t:s0
Birth: -
File: mydata.txt
Context: unconfined_u:object_r:admin_home_t:s0
Birth: -
eg:
File: redhat.txt
Birth: -
[root@localhost ~]# ls
File: newfile.txt
Context: unconfined_u:object_r:admin_home_t:s0
cat command
cat command is used to read the data from files.
syntax:
#cat <operator> <file name> --> create a file with data input
<text> <enter>
#cat -n <file name> --> read file data with line no.
Operator:
eg:
hello world
welcome to grras
[root@localhost ~]# ls
hello world
welcome to grras
hello user
Welcome to redhat
hello world
welcome to grras
hello user
Welcome to redhat
hello world
Welcome to redhat
hello world
Welcome to redhat
hello user
Welcome to redhat
hello user
Welcome to redhat
hello world
Welcome to redhat
hello user
Welcome to redhat
[root@localhost ~]# cat grras1 grras2 grras.txt
hello world
Welcome to redhat
hello user
Welcome to redhat
[root@localhost ~]# ls
hello world
Welcome to redhat
hello user
Welcome to redhat
1 hello world
2 Welcome to redhat
4 hello user
5 Welcome to redhat
hello world
Welcome to redhat
hello ^Iuser
Welcome^I^Ito ^Iredhat
hello world$
Welcome to redhat$
$
hello user$
Welcome to redhat$
1 hello world$
2 Welcome to redhat$
3 $
4 hello user$
5 Welcome to redhat$
6 $
8 $
redirection
[root@localhost ~]# ls
#version=RHEL8
graphical
%packages
@^graphical-server-environment
kexec-tools
%end
# Keyboard layouts
keyboard --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
network --hostname=localhost.localdomain
firstboot --enable
ignoredisk --only-use=sda
autopart
# System timezone
# Root password
rootpw --iscrypted
$6$QI32zDcsNgXNL.6D$oagwMH1jqoGQ50BJ6wz.4v4waex6lBNBKcKOO55XSJr1GnNMIqY7.ki.zsdSwz
IyP1gvni3rOFa2DmSpzVGQ3/
%end
%anaconda
[root@localhost ~]# ls
[root@localhost ~]# ls
anaconda-ks.cfg
apple1.txt
apple2.txt
apple3.txt
apple4.txt
apple5.txt
class.txt
Desktop
Documents
Downloads
file1.txt
grras1
grras2
grras.txt
grras.xt
initial-setup-ks.cfg
linux1redhat1
linux1redhat1centos1
linux1redhat1centos2
linux1redhat2
linux1redhat2centos1
linux1redhat2centos2
linux1redhat3
linux2redhat1
linux2redhat1centos1
linux2redhat1centos2
linux2redhat2
linux2redhat2centos1
linux2redhat2centos2
linux2redhat3
linux3redhat1
linux3redhat2
linux3redhat3
Music
mydata.txt
myfile10
myfile7
myfile8
myfile9
myfileA
myfileB
myfileC
newfile.txt
new.txt
outputfile
Pictures
Public
redhat.txt
sample.txt
Templates
test
test1.txt
test3.txt
text2.txt
Videos
[root@localhost ~]# ls abcdef 2> errorfile redirect error to the specified file
[root@localhost ~]# ls
[root@localhost ~]#