Windows CMD | TASK | Mac OS Terminal |
---|---|---|
dir |
List files and folders | ls |
cd |
Full path of current folder/directory | pwd |
cd <path to directory> |
Change folder/directory | cd <path to directory> |
cd.. |
One directory up in directory tree | cd .. |
cd |
Move to root directory | cd |
mkdir newFolder |
Create new directory in current directory | mkdir myFolder |
echo some-text > fileName(.txt) |
Create new file | cat > fileName(.txt) |
rmdir myFolder |
Remove a directory* | rmdir myFolder |
ren oldFolderName newFolderName |
Rename a directory | mv oldFolderName newFolderName |
robocopy myFolder <path to destination directory> |
Copy a directory | cp -r myFolder <path to destination directory> |
move myFolder <path to destination directory> |
Move a directory | mv myFolder <path to destination directory> |
del myFile |
Remove a file* | rm myFile |
ren oldFileName newFileName |
Rename a file | mv oldFileName newFileName |
copy myFile <path to destination directory> |
Copy a file | cp myFile <path to destination directory> |
move myFile <path to destination directory> |
Move a file | mv myFile <path to destination directory> |
cls |
Clear the terminal screen | clear |
type myFile |
Concatenate and print a file | cat myFile |
type C:/../myFile PIPE** find "" /v /c |
Count lines in a file | wc -l myFile |
Before I get you set up on the Databricks CLI, let me run through some common commands that you can use on your terminal or command prompt to navigate between directories.
If you’re using a mac operating system, then open your terminal.
If you’re using a Windows operating system, then open your command prompt.
I’m on a Windows, so I’ll open my command prompt.
I’ll have the Windows and Mac commands for your reference.
Okay.
So first of all, to get an idea of the current directory that you’re in, you can type PWD on a mac if you’re on a Windows type CD.
So I’ll type CD since I’m on a Windows.
And this is my current directory.
I’m on the root directory.
To list all the folders in your current directory.
You type ls on a mac or dir on a windows.
I’ll type dir.
These are all the folders and files in the root directory.
To navigate to a different directory you type CD followed by a white space and then the path to the new directory.
This can be an absolute path or relative to the current directory.
So if I want to go to the desktop directory, I can type CD space desktop.
And now I’m in the desktop to list all the contents of the current directory, which is now desktop.
You can type die remember on a mac you would type ls.
So these are the contents of my desktop and as you can see.
To go up one directory you can type CD dot dot.
On a mac.
You have to a space so you type CD dot, dot.
now I’m back to the root directory, which I can confirm by typing CD.
And again on a mac it would be PWD.
So as you can see, I’m back on the root directory.
So let me go back to the desktop by typing CD Desktop.
Okay, So now if you type CD either on a mac or a windows, you will go back to the root directory.
As you can see, I’m back on the root directory.
Great.
So these are some super basic commands that will allow you to navigate to different directories.
I’ll share a link with other useful commands and you can review that in your own time as we’ll be using the command line interface.
I just wanted to show you these basic commands.