This is part two of the Command line Interface. So how do we move or change the name of a file in our terminal? We do this my using the mv command.
Lets hope into our terminal and get our hands dirty. To move a file we use mv
To rename the file
To get more detail on a file add the -l flag, where l stands for long form.
$ ls -l
With ls the files are sorted alphabetically. To reverse the order use the -r flag as shown below
$ ls -r
We can also sort using the last modified time by using the -t flag
$ ls -t
To see the actual time we combine -l and -t as shown below
$ ls -lt
We can also reverse the above by adding the -r flag
$ ls -rlt
To sort by file size us upercase S as shown below
$ ls -lS
We can reverse the above by using the file adding r
$ ls -rlS
For human friendly reading use the -h flag. The 'B' is for bytes.
$ ls -lh
To copy a file, lets say we have file-1.md and file-2.md. Start with the source file and end with the target fil. Start with the source file and end with the target file
$ cp file-1.md file-2.md
To copy one directoy to another start with the source directory and end with the target directory
$ cp -Rv directory-2 directory-1