The command touch creates an empty file. We have started in the home directory so the new file will be one level down.
cd folder1 takes us to the folder and ls shows the new file.
mv file1.txt ~/folder2
moves the folder to another subdirectory of the home folder. ls shows the file has moved. Another use of mv is to rename a file. For example
mv file1.txt file2.txt
will rename the file to file2.txt.
cd takes us to folder2 and we confirm the file is there. Copying the file is done like this:
cp file1.txt ~/folder1. Here the
~/folder1
is an absolute reference to /home/folder1
ls shows the file is in both directories
No comments:
Post a Comment