Upgrade ERPNext to the latest version

Hello, I have ERPNext version ‘13.4.1’ and the latest version of bench 5.7.5.
However, the latest version of ERPNext is 13.17.0 and the files in Github are different than I have. How can I upgrade from the terminal?

You can run bench update command to update to 13.17.
If you are running this on production,it is advisable to have backup of your latest data. You can create a backup by bench --site sitename backup

already tried but I got this error:

WARN: Command not being executed in bench directory
ERROR: [Errno 13] Permission denied: '/opt/bench/patches.txt'
Traceback (most recent call last):
    File "/usr/local/lib/python3.8/dist-packages/bench/patches/__init__.py", line 21, in  run
            result = execute(bench_path)
 File "/usr/local/lib/python3.8/dist-packages/bench/patches/v3/celery_to_rq.py", line 
        7, in execute
frappe_branch = get_current_branch('frappe', bench_path)

File “/usr/local/lib/python3.8/dist-packages/bench/utils/app.py”, line 165, in
get_current_branch
return get_cmd_output(“basename $(git symbolic-ref -q HEAD)”, cwd=repo_dir)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 185, in
get_cmd_output
output = subprocess.check_output(
File “/usr/lib/python3.8/subprocess.py”, line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/usr/lib/python3.8/subprocess.py”, line 493, in run
with Popen(*popenargs, **kwargs) as process:
File “/usr/lib/python3.8/subprocess.py”, line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/usr/lib/python3.8/subprocess.py”, line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘/opt/bench/apps/frappe’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/update.py”, line 23, in update
update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, compile=not no_compile, force=force, reset=reset)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py”, line 360, in update
patches.run(bench_path=bench_path)
File “/usr/local/lib/python3.8/dist-packages/bench/patches/init.py”, line 27, in run
with open(target_patch_file, ‘w’) as f:
PermissionError: [Errno 13] Permission denied: ‘/opt/bench/patches.txt’

Please ensure that you run this command inside the bench directory.

it is. isn’t this one “/opt/bench/”. I also tried “/opt/bench/bench-repo/bench” but still same problem