The `sys` module in Python provides access to some variables used or maintained by the Python interpreter and to functions that interact strongly with the interpreter. This module is always available.
Here’s how to use it:
1. First, you need to import the sys module.
```
import sys
```
1. `sys.argv` is a list in Python, which contains the command-line arguments passed to the script.
```
print(sys.argv)
```
Running the script from the terminal like `python script.py arg1 arg2` will output `[‘script.py’, ‘arg1’, ‘arg2’]`.
1. `sys.exit()`: This causes the script to exit back to either the Python console or the command prompt. This is generally used to safely exit from the program in case of generation of an exception.
```
sys.exit()
```
1. `sys.maxsize`: Returns the largest integer a variable can take.
```
print(sys.maxsize)
```
1. `sys.path`: This is an environment variable that is a search path for all Python modules.
```
print(sys.path)
```
1. `sys.version`: This attribute displays the python version.
```
print(sys.version)
```
1. `sys.stdin`, `sys.stdout`, `sys.stderr`: These are used to interact with the standard input, output and errors respectively. These can be overridden.
```
for i in sys.stdin:
if i == ‘\n’:
break
print(f’Input was: {i}’)
```
Using sys module, you can also fetch configuration details, OS details, get size of various datatypes, influence the runtime environment, manipulate the Python runtime environment, manage modules and do many other useful tasks.
Most of these come in handy in advanced topics like file handling, exception handling, command line argument handling, etc.