LINUX FOR BEGINNERS: Guide to understand essentials and operating system, command line and networking. Tips and tricks about basics of security and administration for hackers. Including exercises by Jason Blunt

LINUX FOR BEGINNERS: Guide to understand essentials and operating system, command line and networking. Tips and tricks about basics of security and administration for hackers. Including exercises by Jason Blunt

Author:Jason Blunt [Blunt, Jason]
Language: eng
Format: azw3, epub
Published: 2019-11-12T16:00:00+00:00


Renaming files and directories

Just as we did with the touch command, the behavior of mv can also be used creatively to give us a different outcome. Normally, we use mv to move files or directories into a new directory. Part of that move includes renaming that file or directory. If we were to specify that the destination and the source are the same directory but named differently, that would be a creative use of mv for renaming directories or files.

ls

backups example1 foo

mv foo foo3

ls

backups example1 foo3

cd ..

mkdir linuxpractice/testdir

mv linuxpractice/testdir /home/cleopatra/linuxpractice/frieda

ls linuxpractice

backups example1 foo3 frieda

Let’s delve into this one:

Line 3 : the file called foo was given a new name of foo3. Both paths are relative.

Line 6 : the parent directory was moved. We did this so that in the next line, we could show how to run commands on a file or a directory from outside the directory they are contained in.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.