Basic Commands

Basic Commands#

The following commands are useful to navigate through the file system and to execute programs. The commands are the same for the operating systems Linux, MacOS and even Windows as long as you use the Powershell. The syntax on the Command Prompt is slightly different and will not be covered here.

Navigate to the home directory

cd

Go to a folder (absolute or relative)

cd /my/custom/path

Navigate to parent directory

cd ..

List directory content (Unix only)

ls

List directory content (Windows Powershell only)

dir

Create a folder

mkdir myfolder

Start a program:

./testprogram

Create a file (Unix only)

touch test.py

Create a file (Windows Powershell only)

New-Item test.py

Copy a file

cp test.py test-copy.py

Move (Rename) file

mv test.py test-copy.py

Remove a file

rm test.py

Remove a folder

rm -r /my/custom/path

Copy a file to a different location (directory):

cp test.py /path-to-the-copy/test-copy.py

Execute a python script named test.py (needs to be located in current folder):

python test.py