-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing Terminal
Terminal, command line, is the interface used to connect to the server and run programs. Knowing how to use terminal is necessary to develop backend.
You should either have PuTTY or Terminal, a program with SSH server capabilities.
- SSH - Connect to the server via SSH
- Navigation - Navigate to development directories
- Scripts - Execute scripts
- Permissions - Permissions
- Other - Other useful commands
WARNING Mostly everything in terminal is case-sensitive!
You can connect to the server with the ssh
command:
$ ssh -p [port] [hostname]@[hostIP]
If successful you will be in the home directory for the user which is ~/.
There are certain commands you should be familiar with:
Return's working directory; shows you where you are:
$ pwd
Change the current directory:
$ cd [dir]
Advice: if you want to go to the home directory, in the case you are lost, do not enter a dir
To move up a directory:
$ cd ..
To move into a directory called dir
:
$ cd dir
You can use cd
in many combinations as:
$ cd ../../dir1/dir2
You can use ls
to see files and directory in your current directory:
$ ls
To see more information such as: hidden directors .dir
, permissions, and in a list with color use options:
$ ls -laG
- l - Option: ls present in a list
- a - Option: ls shows more/all information
- G - Option: ls returns with a color scheme
You can use these commands once in the correct directory:
- python - Python interpreter, running python scripts
Use the python
command to run a python script:
$ python [python_script]
Advice: Stuck in your python? use Control-C to interrupt the script
You can use this command to change the read, write, and execute permissions of files and directories:
$ chmod [permission_values] [file]
Refer to this article for permission_values; 755 is likely the value you want to use though.
Some other commands that will help you:
Display manual for command, you can find help right in terminal:
$ man [command]
Removes a file:
$ rm [file]
WARNING: Use carefully, files will be completely deleted and unrecoverable; use option -R
to remove directories.
Logs you out of your user, you can use this to exit the user root
and go back into your own user
$ exit
If you're reading this then stop and go back and figure out how to do it; if you are coming back then: Welcome.
- Run the
ssh
command - Go to backend workspace directory:
cd /root/TheOrangeAlliance/python
- Check you're in the right directory:
pwd
- Use
ls
to find your python script - Running your script:
python myPythonScript.py
Disclaimer: I cannot guess your script name, replacemyPythonScript.py
with whatever your python script is called, this is a case-sensitive command - Stuck in python, do you deserve it? Use Control-C to attempt to interrupt python
- When you're done do
exit
- Go look at some tutorials
By Michael Leonffu March 26, 2017; Last edited by Michael Leonffu March 27, 2017