Interacting with Files and Directories
Interacting
Here is a list of common commands used for interacting with files and directories:
mkdir command
    mkdir – make a new directory of
    the given name, as permissions allow.
$ mkdir Newdir
mv command
    mv – move files, directories, or both
    to a new location.
$ mv file1 Newdir
This can also be used to rename files:
$ mv file1 file2
    
        Use wildcards like * to move all files of a specific
        type to a new location:
    
$ mv *.c ../CodeDir
    You can always verify that the file was moved with ls.
cp command
    cp – copy files, directories, or both
    to a new location.
$ cp file1 ~/
    You can give the copy a different name than the original in the same command:
$ cp file1 file1_copy
    
        To copy a directory, use the -r option (recursively).
        In this case, both the source and the destination are directories,
        and must already exist.
    
$ cp -r Test1 ~/testresults
rm command
    rm – removes files or directories permanently
    from the system.
When you issue
        rm to remove a file, it is difficult to impossible to recover removed files without resorting to backup restore.
$ rm file1
    
        With the -r or -R option, it will
    also remove/delete entire directories recursively and permanently.
$ rm -r Junk
*.
    For instance, the example below will remove all of the files and subdirectories within your current directory, so use with caution.
$ rm -r *
    
    To remove an empty directory, use rmdir
touch command
    touch – changes a file's modification timestamp
    without editing the contents of the file.  It is also useful for creating
    an empty file when the filename given does not exist.
Try these commands to get more familiar with Linux files and directories.
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)