Blog Details

img
Data Science

How do I run Python from command line

Spoke Right / 17 Nov, 2023

In this tutorial, you will learn how to use command line. How you can create, copy, move files and folder from one location to another location using terminal.


Open your vscode and press “cntrl+~ “key to enter into terminal. This terminal is a git bash that we have integrated with vscode. You can test these command as written below:

(note: In linux we treat everything as files or folder. Like if we have a drive in windows system in linux we create LVM which are treated as folder)


  • Cd : by cd command we enter into directory.
    Ex: if we want to move from c drive to e drive.
  • Pwd : shows you present at location/path of the directory.
    Ex:-
  • Mv : to move the directory from one directory/file to another directory.
    Ex: mv


    mv demo_directory/test.py workspace/


  • Cp: to copy the file/directory to another directory.
    Ex: cp -var
    cp -var demo_directory/test.py workspace/newfolder/



  • Mkdir: to make a new directory.

    Ex: mkdir john sara albert

    (above command will create 3 directories named john sara albert in existing location)

    If you want to make a directory having space between them you can do this by following way
    mkdir “ python practice”




  • rm: To remove a file.
    Ex:  $  rm


    rm test.txt


  • rm -fr: To delete directory.
    $  rm -fr workspace


  • ls : to view the details of all the folder.


  • touch: to create a file.


  • Clear: to clear the screen.
    Ex:   clear


  • Code: to start write code in .py file
    Ex: code hello.py


After entering above written command, a new screen will be displayed upside with name of .py file, we will write our program here as shown in following screen.

0 comments

Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20210902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0