File Operations About Linux#
Create file touch
Delete file rm -f
View file cat
Extended commands for file operations
- Create files consecutively
touch a b c
- Delete files consecutively
rm -f a b c
Copy cp source destination
Move mv source destination
To copy directories: cp -a
Tip 1: Make good use of wildcards (*
: any number of characters) like
[root@localhost ~]# ls
a.txt b.txt c.txt abc
[root@localhost ~]# mv *.txt ./abc
[root@localhost ~]# ls
abc
This command moves any files in the current directory that end with txt to the abc folder in the current directory.
Tip 2: Rename files: mv original file name including extension new file name including extension